3 ms·
There's a fantastic, massively upvoted StackOverflow post that can also provide some insight here. This may be a little more accessible, since it's such a signi
by vcarl 10y ago
There's a fantastic, massively upvoted StackOverflow post that can also provide some insight here. This may be a little more accessible, since it's such a significant runtime difference with very simple source code.
http://stackoverflow.com/questions/11227809/why-is-it-faster-to-process-a-sorted-array-than-an-unsorted-array http://stackoverflow.com/questions/11227809/why-is-it-faster...
- globuous 10y agoThanks so much for sharing this, great read ! For those, like me, that want to play with what this stackoverflow talks about, here's a fiddle of it: https://jsfiddle.net/tbinetruy/Latkmk2q/1/ https://jsfiddle.net/tbinetruy/Latkmk2q/1/ (code takes 2s to run and loads firebug for console logs).
- woliveirajr 10y agoThe question is very interesting and good phrased, and the answer is better than many classes that many students had about processors and so on.