Re: Optimize zend_string equality check with hash key
| From: | Andrea Faulds | Date: | Mon, 08 Apr 2019 16:55:36 +0000 |
| Subject: | Re: Optimize zend_string equality check with hash key | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105152@lists.php.net to get a copy of this message | ||
Hi Benjamin,
Benjamin Coutu wrote:
if (ZSTR_H(s1) && ZSTR_H(s1) != ZSTR_H(s2)) {Should that not be like this?:return 0;}
if (ZSTR_H(s1) && ZSTR_H(s2) && ZSTR_H(s1) != ZSTR_H(s2)) {
It would be possible the other string also has no hash value.
Otherwise this sounds sensible to me, but it is also so obvious that I was assuming until now that PHP does it, so maybe someone else knows a reason why we don't? (Maybe it's just not worth the extra branches?)
Thanks,
Andrea