powered by Slim Framework
Follow @NesbittBrian rss

A "quick" microbenchmark update PHP 5.4

May 24, 2012

This is a follow up to A "quick" microbenchmark... you may want to go and read that first.

With the release of PHP 5.4 being toted as a "significant performance improvement" I thought it might be fun to go back and run the quicksort benchmark against the new release. I upgraded to 5.4.3 on my local machine and ran the tests.


LanguageVersionTime in milliseconds
1C++MS 16.00.30319.01 for 80x8675
2C# Array.Sort().NET 3.5100
4Groovy api (aka java)1.8.5110
5Java Arrays.sort()1.6.0_23121
6C#.NET 3.5126
8Node.js (v8)0.6.7175
9Chrome JavaScript16.0.912.77182
10Ruby api array.sort!1.9.2p290250
11Firefox JavaScript10.0271
12IE JavaScript9.0.8112.16421307
13IE JavaScript api sort()9.0.8112.16421375
14Node.js (v8) api sort()0.6.7480
15Chrome JavaScript api sort()16.0.912.77520
16Python api sort()3.1.3814
17PHP api sort()5.3.81441
18PHP api sort()5.4.31516
19Firefox JavaScript api sort()10.03490

Performance improvement? Yes!

The PHP api version was the same as expected. I didn't look at the source but I would not have expected the sort algorthim to have been changed. As you can see though, the implemented version was "significantly" faster as promised... a whopping 45% faster! That is quite the improvement indeed. There are some other breaking compatibility changes though to be aware of. Anyone still relying on register_globals or magic_quotes please step forward !!

As before you can view the code for each implementation on github.

A "quick" microbenchmark  Home PHP on a diet : Up and running with Slim  
blog comments powered by Disqus