fresh92 / cssmin

Automatically exported from code.google.com/p/cssmin
0 stars 0 forks source link

Speed improvement #56

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of CssMin are you using (source and/or build)?
3.0.1

What was the input stylesheet and/or configuration options?
n/a

What is the expected result?
n/a

And what is the actual result and/or error message?
n/a

Please provide any additional information below.
The initialize() method is way too slow. And it cannot be cached because it 
uses glob() which is also very bad for performance. The autoloader 
unnecessarily uses require_once and does not check if an opcode cache exists 
(which it should and if there is one, immediately load all classes). 
initialize() should ideally only be called if the CssMin.php file is not a 
compiled build.

Please see my patch here for an idea:
https://github.com/tatsh/tatsh-overlay/blob/master/dev-php/cssmin/files/cssmin-3
.0.1-initialize-performance.patch

This takes off 40 ms of load time on my site on EVERY load. As far as expense, 
this takes CssMin::initialize() from ~17% to 0.02% (because it checks if the 
file is the compiled one and does nothing from there).

Original issue reported on code.google.com by audvare on 11 Apr 2012 at 12:49