vaadin / sass-compiler

A Java Sass compiler implementation
53 stars 25 forks source link

Improve Saas Compiler by reducing Garbage and Pattern compiles #267

Closed vaadin-bot closed 10 years ago

vaadin-bot commented 10 years ago

Originally by CodingFabian


It is very temping to do a "String".matches("regex"), but it is very expensive because the pattern is compiled every time. If possible the patterns should be cached. I have a patch pending. lets see if gerrit works for saas-compiler as well :)


Imported from https://dev.vaadin.com/ issue #14601

vaadin-bot commented 10 years ago

Originally by @Legioth


Patch appreciated.

Gerrit should work similarly as for the framework, please let me know if there are any issues.

vaadin-bot commented 10 years ago

Originally by CodingFabian


according to my profiles a big impact is the implementation of SimpleSelector.

    @Override
    public boolean equals(Object obj) {
        return obj != null && getClass().equals(obj.getClass())
                && toString().equals(obj.toString());
    }

    @Override
    public int hashCode() {
        return toString().hashCode();
    }

this basically forces a toString() many times. for example when stuff is added to hash sets and like, because it also does hashCode() invocations.

vaadin-bot commented 10 years ago

Originally by CodingFabian


my current patch reduces compilation time from 8 seconds to 4 seconds on our theme.

vaadin-bot commented 10 years ago

Originally by CodingFabian


the review is here: https://dev.vaadin.com/review/#/c/4593/

it contributes about 10% improvement. The main improvement is #14607, which i separated out for easier review.