less.ruby
less.ruby copied to clipboard
lessc execution speed very slow
I am attempting to compile a simple LESS file that @imports two additional simple CSS files. This is taking over 4 seconds! It seems that it should compile almost instantaneously. See also the following thread: "Lessc execution quite slow" http://groups.google.com/group/lesscss/browse_thread/thread/b9c0e10fe0278656/3301d1a420703fad
hmm, that's not normal — it takes 4 seconds to compile a 4000 sloc file on my machine. could you try running rake benchmark
from the less folder? It shouldn't take more than 5-6 seconds.
We are using less in a Python website, have about 12 less files, and recompiling them all whenever there is a change takes up to 25 seconds. Not very nice to develop with.
I've hacked together a quick daemon mode which lets lessc take requests via a socket and send the compiled file back, so it needs to be run only once - this brings us down to 4 seconds.
The code is here: http://github.com/miracle2k/less It's not in any way something ready to be merged, but something along those lines could be considered for mainline.
There is definitely room for a lot of optimizations in the grammar. It's something I'd like to look into at some point. Treetop isn't the fastest parser (being a PEG parser written in ruby) — but I think, by carefully optimizing the grammar, I should be able to get it 2-3x faster.
For me, this is quite an issue as well, in our project we have a lot of source less files. Whenever there's a change in any of there files, we glue them together into one huge less file, which takes about 20 seconds to compile on a local machine and about 10 seconds on the server. Is there any other (significant) room for improvements apart from optimizing the grammar?
Well, if you're using the more
plugin, it has built in caching now, so it won't recompile files which haven't changed. This is a huge performance boost in dev. If you have a different infrastructure, maybe you can implement something similar, where files are compiled only if they have changed.