Hi all, I've tried to see how packed array is faster with following code
http://3v4l.org/TQd6c I confirmed when start index is non-zero, hash is used by zend_hash_index_find(). I got following result. (with much larger number of elements/loops) Fedora 22 + current master without --enable-debug 1st "Time" is total execution time. 2nd "Time" is the time spent by "for loop" Hash [yohgaki@dev php-src]$ ./php-bin ~/tmp/array_bench2.php Time: 1.7903809547424 Time: 1.1529920101166 [yohgaki@dev php-src]$ ./php-bin ~/tmp/array_bench2.php Time: 1.8049499988556 Time: 1.1719739437103 Packed [yohgaki@dev php-src]$ ./php-bin ~/tmp/array_bench2.php Time: 1.7407248020172 Time: 1.1594388484955 [yohgaki@dev php-src]$ ./php-bin ~/tmp/array_bench2.php Time: 1.7248120307922 Time: 1.1530420780182 Packed array is not so fast, even if zend_hash.c seems much faster with packed array. Just FYI. Regards, P.S. Am I doing something wrong? HHVM seems to have optimization margins for hash and loop. -- Yasuo Ohgaki yohg...@ohgaki.net