Req #71102 [Csd]: Dead code elimination
Edit report at https://bugs.php.net/bug.php?id=71102&edit=1
ID: 71102
User updated by: flip101 at gmail dot com
Reported by: flip101 at gmail dot com
Summary: Dead code elimination
Status: Closed
Type: Feature/Change Request
Package: Performance problem
PHP Version: Irrelevant
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
if (4 > 10-15) {} <-- wrong example, should have been --> if (4 > 10-5) {}
Previous Comments:
------------------------------------------------------------------------
[2015-12-12 14:09:53] laruence@php.net
We do it in opcache. you can look into ext/opcache/Optimizer/
------------------------------------------------------------------------
[2015-12-12 14:05:35] flip101 at gmail dot com
Description:
------------
When php parses the source files and converts it to bytecode, does it do dead code elimination? For
things like
if (false) {}
or when using constants (self defined or predefined)
or when checking certain expressions such as if (4 > 10-15) {}
I couldn't find anything about this after searching. It would certainly benefit libraries which
have a lot of version checks and checks on which operating system it's using. To me
(unknowingly of anything happening in the compiler) it seems a bit low hanging fruit optimization,
but perhaps to cover all the edge cases is not so trivial. However a partial implementation would
already help a lot. In case it does exist please link to relevant documentation or source files.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71102&edit=1
Thread (4 messages)