TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Branchless Lomuto Partitioning

38 pointsby killcoderover 1 year ago

4 comments

killcoderover 1 year ago
There was a recent post by Voultapher from the sort-research-rs project on Branchless Lomuto Partitioning<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Voultapher&#x2F;sort-research-rs&#x2F;blob&#x2F;main&#x2F;writeup&#x2F;lomcyc_partition&#x2F;text.md">https:&#x2F;&#x2F;github.com&#x2F;Voultapher&#x2F;sort-research-rs&#x2F;blob&#x2F;main&#x2F;wri...</a><p>Discussion here:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38528452">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38528452</a><p>This post by orlp (creator of Pattern-defeating Quicksort and Glidesort) was linked to in the above post, and I found both to be interesting.
kazinatorover 1 year ago
What can you actually sort branch-free? Doesn&#x27;t the comparison have to be inlined, and tiny, not to mention itself branchless? Forget string keys.<p>IPv4 addresses in a routing table or something.<p>Pointers, by increasing or decreasing address. Useful if we want to compact the objects in memory.<p>It&#x27;s useful to sort floating-point values in a certain way before adding them together, to avoid adding a low magnitude X to a big magnitude Y such that X disappears.
评论 #38548354 未加载
评论 #38552640 未加载
orlpover 1 year ago
Author here if anyone has any questions.
评论 #38542561 未加载
评论 #38542685 未加载
评论 #38542609 未加载
kazinatorover 1 year ago
Lomuto partitioning is flawed though; when implementing Quicksort, you want the original Hoare one.<p>Has someone attempted branchless Hoare partitioning?
评论 #38548322 未加载