On Nov 6, 2008, at 10:37 AM, shire wrote:


However, while the common compare_function call probably wouldent gain anything from this, maybe it could be put in the TYPE_PAIR(IS_STRING, IS_STRING) case or put into zendi_smart_strcmp (which only seems to ever be called by the TYPE_PAIR(IS_STRING, IS_STRING) case of compare_function).

I havent played with the patched version of zend_hash_compare to see if it might provide any real world savings. Though it appears as if that function might see a significant improvement for these cases.

Arrays and strings do seem to be the only real worth while comparisons for this type of optimization, but only because the costs of comparing long strings and large array lists make the savings more significant. I think it might be hard to see this in a real world application though, so it would be nice if someone could justify the change by showing test results. I'll try to bench Facebook's code base to see what we can get out of it.


I just ran a quick benchmark on this and I'm not seeing a significant real world change for Facebook's codebase. (definitely less than 1%) This was a pretty small test, without a lot of code execution, so I could see other applications doing better. I'm pretty neutral on this one, it's not a really big change so might be worth adding if it's going to give a few applications out there a gain, but I couldn't see doing this everywhere of course.

-shire

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to