emogrifier icon indicating copy to clipboard operation
emogrifier copied to clipboard

Profile the performance and find bottlenecks

Open oliverklee opened this issue 9 years ago • 8 comments

@vanderlee Would you be willing to provide a performance testcase for this with some (bigger) real-world-like data?

oliverklee avatar Jul 09 '15 21:07 oliverklee

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 avatar Jul 10 '15 06:07 vanderlee

@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).

oliverklee avatar Jul 10 '15 07:07 oliverklee

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.

vanderlee avatar Jul 10 '15 09:07 vanderlee

Tests/Performance/...Test.php Tests/Performance/TestData/....html, ....css

oliverklee avatar Jul 10 '15 16:07 oliverklee

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).

vanderlee avatar Jul 10 '15 18:07 vanderlee

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

oliverklee avatar Jul 11 '15 10:07 oliverklee

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.

vanderlee avatar Jul 12 '15 14:07 vanderlee

We can put the performance tests into a Composer script.

oliverklee avatar Oct 01 '19 12:10 oliverklee