Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    B

    Branchfree

    branchfree.org · Personal blog · on HN since 2018

    Branchfree is a blog on SIMD programming, bit-level tricks, and fast parsing and automata, with posts on x86 and ARM instructions.

    Visit blogRSSHN submissions
    Systems & PerformanceHardware & Electronics
    What HN says

    Commenters cite it as a good source on SIMD topics, including its ARM Neon movemask substitutes and its taxonomy of SIMD usage.

    Stats for nerds
    26HN people shared it
    22linked in comments
    479story points
    Apr 2025last shared
    2019people per year2025

    Top posts on HN

    1. 1
      An Intel Programmer Jumps over Wall: First Impressions of ARM SIMD Programming
      1 person · 167 points · first shared 2019 · 38 comments on HN
    2. 2
      Hyperscan: A Fast Multi-Pattern Regex Matcher for Modern CPUs
      1 person · 148 points · first shared 2019 · 36 comments on HN
    3. 3
      Why Ice Lake is Important – a bit-basher’s perspective
      4 people · 112 points · first shared 2019 · 41 comments on HN
    4. 4
      A (Draft) Taxonomy of SIMD Usage
      5 people · 17 points · first shared 2024 · 4 comments on HN
    5. 5
      Show HN: Sheng, a Small but Fast Deterministic Finite Automaton
      4 people · 7 points · first shared 2018 · Discussion on HN
    6. 6
      Some opinions about “algorithms startups”, from a sample size of approximately 1
      2 people · 6 points · first shared 2018 · 1 comments on HN
    7. 7
      Code Fragment: Finding quote pairs with carry-less multiply (PCLMULQDQ)
      4 people · 5 points · first shared 2019 · Discussion on HN
    8. 8
      Bits to indexes in BMI2 and AVX-512
      3 people · 5 points · first shared 2018 · Discussion on HN
    9. 9
      Question: Is matching *fixed* regexes with Back-references in P?
      5 people · 4 points · first shared 2019 · Discussion on HN
    10. 10
      The Environment Will Be Saved If We Just Avoid Doing Icky Things (2024)
      2 people · 4 points · first shared 2024 · 1 comments on HN

    What HN people wrote when they linked it

    • zwegnerDec 2021

      Yeah, I see how the quoting complications make CLMUL pretty hard to use (or just useless). I have a few ideas about how to deal with the quoting/escaping, and if I get some free time in the near future I'll try and code something up.

      I've also pinged Geoff and Daniel on Twitter, linking your library: https://mobile.twitter.com/zwegner/status/1473400733525544973 ...maybe they'll have some ideas. (Geoff has mentioned that he had done some initial work on a simdcsv)

      I'll also drop some more links that you might've already seen, but could be useful otherwise.
      For removing double quotes, rather than memmove, you could use the "pack left" operation on vectors. There's a handful of ways to do this pre-AVX-512-VBMI2 (where the magical vcompressb instruction was added), like in these SO questions:

      https://stackoverflow.com/questions/36932240/avx2-what-is-the-most-efficient-way-to-pack-left-based-on-a-mask

      https://stackoverflow.com/questions/45506309/efficient-sse-shuffle-mask-generation-for-left-packing-byte-elements

      And for keeping the main lexer structure that ZSV uses now, but using a small DFA to maintain the lexer state, this other trick from Geoff might work: https://branchfree.org/2018/05/25/say-hello-to-my-little-friend-sheng-a-small-but-fast-deterministic-finite-automaton/

    • BeeOnRopeDec 2021

      You can probably get another "few x" faster still:

      https://branchfree.org/2019/03/06/code-fragment-finding-quote-pairs-with-carry-less-multiply-pclmulqdq/

      Based on a cursory scan this is the same problem so Geoff's trick should be directly applicable.

      The ideas are quite similar: using bit manipulation to detect the in and out regions. Geoff's trick does the "smearing" of the bits in a single SIMD "carryless multiply", plus some supporting stuff. It is constant time for an input word: there is no dependence on the number of bits. So it could be many times faster for inputs with very dense quotes.

      For an actual implementation, you'd want to handle the case where you don't have any quotes at all or where they are very sparse, which is common to a lot of CSV with a fast path that bails out when it sees a quote (possibly to be be resumed later if there is again a quote-free run).

    • glangdaleApr 2021

      PMOVMSKB is a great instruction, and 3c understates how cheap it is - if you have a throughput problem (rather than a latency problem) it's even more efficient relative to the ARM equivalent.

      I have a blog post about coping strategies for working around the absence of PMOVMSKB on NEON:

      https://branchfree.org/2019/04/01/fitting-my-head-through-the-arm-holes-or-two-sequences-to-substitute-for-the-missing-pmovmskb-instruction-on-arm-neon/

      We used these techniques in simdjson (which I presume still uses them; the code has changed considerably since I built this): https://github.com/simdjson/simdjson

      The best techniques for mitigating the absence of PMOVMSKB require that you use LD4, which results in interleaved inputs. This can sometimes make things easier, sometimes harder for your underlying lexing algorithm - sadly, it's not a 1:1 transformation of the original x86 code.

    • mumumuJan 2023

      *avoid branches

      The blog post I mentioned:

      Paper: Parsing Gigabytes of JSON per Second
      https://branchfree.org/2019/02/25/paper-parsing-gigabytes-of-json-per-second/

      Another related post from Lemire:

      Ridiculously fast unicode (UTF-8) validation
      https://lemire.me/blog/2020/10/20/ridiculously-fast-unicode-utf-8-validation/

      Those algorithms are fast. But to put them in perspective. A single x86 CPU can write 64B per cycle. At 5GHz, the theorical maximum bandwidth is 320 GBps. IIRC, the read bandwidth is twice that.

      There are others botlenecks, and is very hard to write code that writes at every cycle.

      A interesting consequence, is that the theorical maximum bandwidth is logarithmical to the number of cycles. Again, talking about branchless streaming application.

    • camel-cdrJun 2023

      I found the following article about the topic really good: https://branchfree.org/2019/04/01/fitting-my-head-through-the-arm-holes-or-two-sequences-to-substitute-for-the-missing-pmovmskb-instruction-on-arm-neon/

      In my experience using a 512 wide movemask (to uint64_t) is the fastest on both x86 and arm64.

      With rvv you don't really what to go from a vector mask to a general purpose non vector register, because the vector length may vary. But I found it really useful that vector masks are always packed into v0. So even with LMUL=8, you can just to a vmseq, switch to LMUL=1 and use vfirst & vmsif & vmandn to iterate through all indices. (Alternatively vfirst & vmsof & vmclr would also work, I'm not sure which one would be faster)

    • burntsushiFeb 2020

      Nope. That still supports backreferences, and resolving backreferences is an NP-complete problem.[1] And I don't see anything in that paper that addresses that. Note that there may be some versions of the problem that maybe aren't NP-complete[2], but again, not addressed by that paper.

      Besides, that paper was published 12 years ago. Where is the productionized version of it? Or are you suggesting the the OP go spend a few years writing a regex eninge? :-) Doesn't seem like a particularly practical suggestion.

      [1] - https://perl.plover.com/NPC/NPC-3SAT.html

      [2] - https://branchfree.org/2019/04/04/question-is-matching-fixed-regexes-with-back-references-in-p/

    Related

    Cambuscambus.net44 people

    Oldest domains in the .com, .net, and .org TLDs

    Cambus
    Personal · last shared 2026
    Hexops Devlogdevlog.hexops.com27 people

    Zig, parser combinators, and why they're awesome

    Hexops Devlog
    Company · last shared 2025
    Arm Community Blogcommunity.arm.com147 people

    An update on GNU performance

    Arm Community Blog
    Company · last shared 2025
    euroquiseuroquis.nl24 people

    Python and SysV Shared Memory

    euroquis
    Personal · last shared 2025
    Probably Danceprobablydance.com74 people

    Fibonacci Hashing: The Optimization That the World Forgot

    Probably Dance
    Personal · last shared 2026
    Better Programmingbetterprogramming.pub319 people

    Three programmers got fired, including me, due to a single app crash

    Better Programming
    Publication · last shared 2025
    codeburst.iocodeburst.io174 people

    Google’s Flutter = React and Java Swing

    codeburst.io
    Publication · last shared 2023
    fdiv.netfdiv.net16 people

    Objectivist C

    fdiv.net
    Personal · last shared 2026