Skip to content
GitHub

Don't stop early: Case-folding source code at memory speed

Jul 31, 2026Alexander Neubeck, Greg Orzell19 min read
Opens github.blog
What the post coversAI, from the source post

This post details significant performance optimizations for case folding, particularly for ASCII characters, by removing early exits and optimizing for vectorization.

  • It introduces a branchless ASCII folding implementation that achieves memory bandwidth speeds (>45 GiB/s) by eliminating branches and leveraging vectorization.
  • The post also covers efficient handling of Unicode case folding and memory management to avoid unnecessary allocations, including a strategy for allocating a worst-case buffer once for Unicode folds that might increase string length.
  • The open-sourced Rust crate `casefold` implements these optimizations.
Read the full post on github.blog · 19 min (opens in a new tab)

More from the Case Folding for Code Search trail