krakjoe / nocheq

Sick of pesky type checking making your code too slow (and correct) ?

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nocheq

This is an experiment, in response to:

https://en.reddit.com/r/PHP/comments/cl2p1z/something_to_consider_what_about_disabling/

install nocheq

To build:

phpize
./configure
make install

To install:

zend_extension=nocheq.so

How it Works

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.

Is this actually going to improve performance ?

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.

Will you work on this ?

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

About

Sick of pesky type checking making your code too slow (and correct) ?

License:Other


Languages

Language:C 85.5%Language:PHP 12.1%Language:M4 2.4%