leafo/lessphp — pull request #180 by vanderlee (2012-01-24 19:05:10+00:00)
Title: Some performance improvements.

I've profiled (using xdebug) LessPHP's performance based on my https://github.com/vanderlee/Afterdark project as a realistic project and applied some improvements.

The most problematic are the literal() and match() methods, which combined use is some ~40% of CPU time in my test cases. These changes decrease runtime by about 1/4th.

- Replaced file_exists() with is_file(); minor improvement.
- Moved variable() method higher up in the value() method; ~5% less calls to literal() method.
- Replaced strlen()'s with isset({})'s in literal() method; ~47% faster method, ~19% faster overall.
- Parse string in literal() method without using match() method; ~50% less calls to match method; ~6% faster overall.