optimization for function call without paremters
| From: | Lin Yo-An | Date: | Fri, 15 Apr 2016 09:27:09 +0000 |
| Subject: | optimization for function call without paremters | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-92327@lists.php.net to get a copy of this message | ||
Hi Dmitry,
I found that INIT_FCALL doesn't use opline->result.var and DO_ICALL doesn't
use op1 or op2. The original purpose of separating these two op was for
sending parameters.
However, if a function doesn't need parameters and it's an internal
function, I think the operation could be merged into INIT_FCALL.
So I guess we can do this below to reduce one bytecode for each function
call without parameters:
if (opline->extended_value == 0) {
// call the function directly and store the value in the result.
}
Your thoughts?
Best Regards,
Yo-An Lin