Bug #70092 [NEW]: pg_field_type() is too slow

From: Date: Fri, 17 Jul 2015 21:16:58 +0000
Subject: Bug #70092 [NEW]: pg_field_type() is too slow
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194521@lists.php.net to get a copy of this message
From: yohgaki Operating system: PHP version: master-Git-2015-07-17 (Git) Package: PostgreSQL related Bug Type: Bug Bug description:pg_field_type() is too slow Description: ------------ Somehow pg_field_type() became very slow. Other functions that share the same code pg_field_name()/etc is not affected. Test script: --------------- <?php $db = pg_connect('host=localhost') or die('Cannot connect db'); $res = pg_query('SELECT * FROM test'); $start = microtime(true); for ($i = 0; $i < 10000; $i++) { pg_field_type($res, 1); } echo 'pg_field_type(): '.(microtime(true)-$start)."\n"; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { pg_field_name($res, 1); } echo 'pg_field_name(): '.(microtime(true)-$start)."\n"; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { pg_field_size($res, 1); } echo 'pg_field_type(): '.(microtime(true)-$start)."\n"; Expected result: ---------------- pg_filed_type() should be as fast as pg_filed_name()/etc Actual result: -------------- PHP 7 and master [yohgaki@dev PHP-master]$ ./php-bin ../t.php pg_field_type(): 3.1048510074615 pg_field_name(): 0.0023491382598877 pg_field_type(): 0.0014290809631348 PHP 5.6 [yohgaki@dev PHP-master]$ php ../t.php pg_field_type(): 0.0019080638885498 pg_field_name(): 0.0013489723205566 pg_field_type(): 0.0010430812835693 -- Edit bug report at https://bugs.php.net/bug.php?id=70092&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70092&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70092&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70092&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70092&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70092&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70092&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70092&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70092&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70092&r=support Expected behavior: https://bugs.php.net/fix.php?id=70092&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70092&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70092&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70092&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70092&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70092&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70092&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70092&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70092&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70092&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70092&r=mysqlcfg

« previous php.bugs (#194521) next »