A "quick" microbenchmark update PHP 5.4
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.
Results
Language | Version | Time in milliseconds | |
---|---|---|---|
1 | C++ | MS 16.00.30319.01 for 80x86 | 75 |
2 | C# Array.Sort() | .NET 3.5 | 100 |
3 | Java | 1.6.0_23 | 105 |
4 | Groovy api (aka java) | 1.8.5 | 110 |
5 | Java Arrays.sort() | 1.6.0_23 | 121 |
6 | C# | .NET 3.5 | 126 |
7 | Scala | 2.9.1.final | 128 |
8 | Node.js (v8) | 0.6.7 | 175 |
9 | Chrome JavaScript | 16.0.912.77 | 182 |
10 | Ruby api array.sort! | 1.9.2p290 | 250 |
11 | Firefox JavaScript | 10.0 | 271 |
12 | IE JavaScript | 9.0.8112.16421 | 307 |
13 | IE JavaScript api sort() | 9.0.8112.16421 | 375 |
14 | Node.js (v8) api sort() | 0.6.7 | 480 |
15 | Chrome JavaScript api sort() | 16.0.912.77 | 520 |
16 | Python api sort() | 3.1.3 | 814 |
17 | PHP api sort() | 5.3.8 | 1441 |
18 | PHP api sort() | 5.4.3 | 1516 |
19 | Firefox JavaScript api sort() | 10.0 | 3490 |
20 | Ruby | 1.9.2p290 | 3520 |
21 | Groovy | 1.8.5 | 4100 |
22 | PHP | 5.4.3 | 5302 |
23 | Python | 3.1.3 | 8100 |
24 | PHP | 5.3.8 | 9700 |
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.