diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-11 20:59:33 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-11 20:59:33 +0100 |
commit | 6e772f474531770792bf1e6143e38257c38c8cee (patch) | |
tree | 9d6dc4b4bf1d8fc977c154832ff3a3b7efeadddb /documentation | |
parent | f1232c4fc3fa27103ec220afb36124419b1b046e (diff) |
updated stupid question over the bubblesort example
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/bubblesort.html | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/documentation/bubblesort.html b/documentation/bubblesort.html index 3125b6e..fe5d6b5 100644 --- a/documentation/bubblesort.html +++ b/documentation/bubblesort.html @@ -173,6 +173,23 @@ Native: 0.79793095588684 seconds Scripted: 8.9202060699463 seconds </pre> </p> +<h2>And now a stupid question</h2> +<p> + How would the native bubblesort function compare to the built-in sort + function of PHP? This - as you will hopefully understand - is not a very + smart question. Bubblesort is an extremely inefficient algorithm, which + should never be user for real sorting. We have only used it here to demonstrate + the performance different between PHP and C++ if you run <i>exactly the same</i> + algorithm in the two languages. +</p> +<p> + The built-in sort() function of PHP is much faster than bubblesort. It is + based on quicksort, one of the best and most famous sorting algorithms there + is. And on top of that: the built-in sort() function is implemented in C! + Thus, when you compare the example C++ bubblesort function with the built-in + PHP sort() function, you are comparing two native implementations, and of + course quicksort wins over bubblesort big time! +</p> <h2>Summary</h2> <p> C++ is faster - much faster - than code in PHP, even for very simple scripts. |