On Thu, Jun 11, 2015 at 4:21 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: > 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
How are you testing hash vs packed? As far as what you posted I cannot tell a difference – it looks like you are running the same thing twice (same binary and same input file). -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php