Skip to content
FrozenVoid edited this page Jun 10, 2022 · 5 revisions

combsort.h provides a modern implementation of combsort that is effective at sorting arrays in-place without overhead.

Combsort is elegant, robust and very small in code size: a single loop with conditional swap (the do loop only sets the gap).

Arrays smaller than 140 elements will be fastest with combsort(except perhaps some sorting network code).

Arrays below 10M will be sorted under a second on modern hardware.

combsort scales better than quadratic due cmov's being cheap(see Performance page).

wikipedia article on combsort:

https://en.wikipedia.org/wiki/Comb_sort

Clone this wiki locally