From: sailormax at inbox dot lv Operating system: PHP version: 5.3.19 Package: Performance problem Bug Type: Feature/Change Request Bug description:check type functions -> check type operators
Description: ------------ Currently check type functions (is_string, is_int, is_float, is_bool, is_object, is_array) are functions. They are very often use in many engines. But because they are functions - they are very slow for engines. In result engine authors have to use faster alternatives (~2x faster) like: is_string => ((string)$var === $var) is_int => ((int)$var === $var) is_float => ((float)$var === $var) is_bool => ((bool)$var === $var) is_object => ((object)$var === $var) is_array => ((array)$var === $var) Can you compile this type of functions as operators? thank you. Test script: --------------- $ts = microtime(true); for ($i=0; $i<50000; $i++) $res = is_string($_GET); var_dump(microtime(true) - $ts); print "<br /><br />"; $ts = microtime(true); for ($i=0; $i<50000; $i++) $res = ((string)$_GET === $_GET); var_dump(microtime(true) - $ts); print "<br /><br />"; Expected result: ---------------- equal time Actual result: -------------- is_string ~ 2x slower than ((string)$_GET === $_GET) -- Edit bug report at https://bugs.php.net/bug.php?id=63655&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63655&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63655&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63655&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63655&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63655&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63655&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63655&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63655&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63655&r=support Expected behavior: https://bugs.php.net/fix.php?id=63655&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63655&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63655&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63655&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63655&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63655&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63655&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63655&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63655&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63655&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63655&r=mysqlcfg