This is an experiment, in response to:
https://en.reddit.com/r/PHP/comments/cl2p1z/something_to_consider_what_about_disabling/
To build:
phpize
./configure
make install
To install:
zend_extension=nocheq.so
Well tested code may have type the majority of type checking disabled in production, if it is developed and tested using strict type checking.
First nocheq registers new optimized versions of RECV_INIT
(param with default value), and RECV_VARIADIC
, leaving the original handlers unmodified.
Upon construction of every op array, Zend allows nocheq to scan the op array and remove avoidable RECV
and VERIFY_RETURN
instructions, nocheq goes on to detect if any RECV_INIT
or RECV_VARIADIC
instruction may be replaced by the optimized version.
In strict mode, PHP has special behaviour for double
, which nocheq preserves, such that your code will behave exactly the same with and without nocheq loaded.
Simple, kinda.
I don't know: This code has been rewritten and benchmarked several times such that on a real world test suite (php-code-coverage), nocheq will achieve between a 10% and 15% increase in performance.
I haven't implemented support for avoiding type checks on typed properties right now.
If I'm presented with really good justification for the continued development of this extension then I'll work on it, otherwise it was a fun Sunday thing that kept me occupied for half an hour.
Peace out phomies ...