Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror

Submission + - Boundless Binary Search: An up to 40% faster binary search implementation (github.com)

scandum writes: The most commonly used binary search variant was first published by Hermann Bottenbruch in 1962 and hasn't notably changed since. Binary searches are one of the corner stones of computer science and can be found in countless software applications, from Google's state of the art b-tree data structure to a browswer's unicode parser which runs a binary search every time it encounters an UTF-8 encoded emoticon.

Recently several new binary search variants have been published that can give a performance increase of up to 40% for 32 bit integers. Given the widespread use of binary searches these new variants (ranging from 15 to 30 lines of C code) could noticeably reduce the worldwide energy consumption by computing systems.

The reason the algorithms are faster appears to be a combination of simpler calculations, branch prediction, and a reduction in cache misses. The reason why it took 60 years to come up with an improved algorithm is likely due to the solution requiring two novel changes to the traditional algorithm.

Submission + - Quadsort: A stable sorting algorithm faster than quicksort and Timsort (github.com)

scandum writes: Long has the conviction been held that quicksort is faster than merge sort. Timsort (derived from merge sort and insertion sort) was introduced in 2002 and while slower than quicksort for random data, Timsort performs better on ordered data.

Quadsort (derived from merge sort) was introduced in 2020 and is faster than quicksort for random data, and slightly faster than Timsort on ordered data.

Also of notice is the significant performance difference on small arrays, quadsort is on average two times faster than Timsort on data sets between 10 and 1000 elements. Quadsort achieves this performance through several optimizations spread out over 1500 lines of code that get the maximum performance out of merge sort.

Slashdot Top Deals

The number of arguments is unimportant unless some of them are correct. -- Ralph Hartley

Working...