emogrifier
emogrifier copied to clipboard
Profile the performance and find bottlenecks
@vanderlee Would you be willing to provide a performance testcase for this with some (bigger) real-world-like data?
I'll see what I can do. These probably won't fit in PHPUnit and can't produce clean "ok/fail" results as they depend on many external factors. Also, they would slow down the automated tests significantly.
@vanderlee Great, thanks!
Actually, the performance tests should not be PHPUnit tests, but just some PHP scripts that generate some numbers (and be it that they provide some bigger data and a starter script which allows us to profile the performance using xdebug).
Any preference for a directory/file structure? It'll have to use atleast a few large HTML files that I prefer not to mix with the code. I suggest a subdirectory with a simple index page to select options and corpus, a "testrunner" page and a subdirectory for the HTML files.
Tests/Performance/...Test.php Tests/Performance/TestData/....html, ....css
Just to jump ahead a bit; how good (roughly) is the unittest coverage?
I tried some basic things (tuning trim
, strtolower
, in_array
and strlen
's, there's even an entire preg_replace_callback
that can be removed if the strtolower
truely doesn't have an impact), with zero change to the unittests and an easy ~25% performance increase. (here).
The unit tests code coverage (regarding both the lines and the functionality) is almost perfect. The only thing not yet covered is the first-child/last-child/nth-child functionality. This functionality currently is broken, and I'd prefer if we fixed it first. I'll appreciate any help on that: #192 #51 #71
The requirements this project puts on it's contributions make it highly inefficient, ineffective and, quite frankly, frustrating. I may contribute some things for this issue and/or other changes, but I will no longer be wasting my time on clearly subjective matters that do not impact the quality or functionality in (IMHO) any meaningful way.
We can put the performance tests into a Composer script.