News for hackers. Stuff that matters.
Re:Fast Sorting, Branchless by Design by tialaramex on Friday February 20, 2026 @08:27AM (#47087783)
> often being faster than std pdqsort.

pdqsort is a generic comparison sort. Want to sort employee names, customer email addresses, JSON blobs, or Zebras? No problem, pdqsort just needs an ordering, in both Zig and C++ you write this as a single boolean "less" predicate.

DJB's speed-up relies on vectorization, which works great for integers or things you can squint at and see an integer - but obviously can't sort your employee names, customer email addresses, JSON blobs or Zebras. You could write these branchless network designs anyway but I'm pretty sure they'd be markedly slower, at least for some common inputs.

There are no comments on this comment yet.