Sometimes some has to process a huge amount of data, applying stupid tests and formulas. There I was and stuck on low performance problem.
The obvious way is to implement the critical part (the stupid tests and formula in C and process the data using the C implementation only), sadly it’s often not even possible to customize php.
Having reached a point where no further optimizations were possible, I start to see what is slow inside php or what I can add to make trivial tasks faster.
One test surprised me: get the sign of a number.
So I go for a new get_sign() internal function and these results:
get_sign: 0.095184011459351 php tests: 0.21789693832397
No comment as I’m pretty sure such new functions will be rejected, keeping in mind the famous „1 line php code“ rule. What’s about (default) speed is my only anwser.