Since my last post comparing Go vs Node vs HHVM, I decided I would do it properly.
First off, the previous test didn’t really sort the array one million times, it merely sorted once then iterated over the sorted array 999,999 times. Also, my previous test focussed on HHVM & PHP with OPCache and trusted the results from @jaxbox for the Go & Node. Given I’ve fixed the sorting of the array loop, I had to go and run the node & go tests myself. Thanks to my colleague at work for providing me a C version for comparison!
$ time ./a.out
$ time ./bubble
$ time node bubble.js
$ time hhvm -v Eval.Jit=true hhvm.php
PHP 5.5 OPcache
Sorry for the crappy formatting of the results above. Maybe one day I shall put them in a table.
But basically you can see that in terms of bubble sorting; C > Go > Node > HHVM > PHP
However you look at it, I think it’s a no brainer to use HHVM!
Summary of best times:
|PHP 5.5.8 w/OPCache||27.336s|