Idea of optimizing php !empty(...) expression.
| From: | Oleg Serov | Date: | Sat, 07 Feb 2015 23:13:05 +0000 |
| Subject: | Idea of optimizing php !empty(...) expression. | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-82103@lists.php.net to get a copy of this message | ||
I use !empty() very often and decided to make a benchmark test.
Here is the code and results: http://pastebin.com/fMhhdQiW
if (!empty(...)) working on 23% slower than if (empty()) expression.
So if create new operator not_empty() it will improve performance.
The first question is: What do you think about optimizing !empty(...), do
we need it ?
And I see two way to make this happen.
1. Create new language entity "not_empty".
2. Improve parser and help to handle "!empty" calls different way.
It is obviously that option 2 is better. Is it real to optimize parser that
way?
Thanks!
--
Best Regards,
Oleg