Anyways, despite mergesort is a good algorithm, js's v8 engine implements timesort, wich is an improvement on mergesort. That results on Array#sort faster than a dev side algorithm.
Try its performance with large (or growing) inputs and compare it against -for example- inputs.sort((n1, n2) => ((n1 - n2) / Math.abs((n1 - n2))) | 0 )
That said... it's a really good explanation on sorting.
Nice post, congrats!
Anyways, despite mergesort is a good algorithm, js's v8 engine implements timesort, wich is an improvement on mergesort. That results on Array#sort faster than a dev side algorithm.
Try its performance with large (or growing) inputs and compare it against -for example- inputs.sort((n1, n2) => ((n1 - n2) / Math.abs((n1 - n2))) | 0 )
That said... it's a really good explanation on sorting.
Cheers!
I will have to look into this! Thank you by the way for the support!
you mean timsort : v8.dev/blog/array-sort#timsort