4 ms·
It's funny though. Several years ago a coworker did some profiling on one of our server software components and found that it was spending up to 10% of the CPU
by ConceptJunkie 4y ago
It's funny though. Several years ago a coworker did some profiling on one of our server software components and found that it was spending up to 10% of the CPU time in strlen()... for very similar reasons.
- sfteus 4y agoHad something similar happen with low-level components in a PHP application I inherited repeatedly calling trim() and/or str_pad() on values that had already been processed. Refactoring those out led to a 10-15% performance boost in our test suites.
- Sesse__ 4y agoI've seen PHP applications use 30% of their CPU in the “realpath cache”, which at the time was a super-slow (O(n²) in this case) home-grown hash table for caching the result of realpath(), which was called all the time because someone decided include_once() needed to run its paths through realpath() in case someone included a file multiple time through symlinks. And I guess they couldn't trust inode numbers or Windows didn't have them or something… I hope it's gone. I really do hope it's gone :-)