Req #71102 [Opn]: Dead code elimination

From: Date: Sat, 12 Dec 2015 14:09:54 +0000
Subject: Req #71102 [Opn]: Dead code elimination
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197830@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71102&edit=1

 ID:                 71102
 Updated by:         laruence@php.net
 Reported by:        flip101 at gmail dot com
 Summary:            Dead code elimination
 Status:             Open
 Type:               Feature/Change Request
 Package:            Performance problem
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

We do it in opcache. you can look into ext/opcache/Optimizer/


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#197830) next »