{"id":3143,"date":"2026-07-31T16:00:00","date_gmt":"2026-07-31T16:00:00","guid":{"rendered":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/"},"modified":"2026-08-01T16:59:28","modified_gmt":"2026-08-01T16:59:28","slug":"dont-stop-early-case-folding-source-code-at-memory-speed","status":"publish","type":"post","link":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/","title":{"rendered":"Do not cease early: Case-folding supply code at reminiscence pace"},"content":{"rendered":"<p><br \/>\n<\/p>\n<div id=\"\">\n<p class=\"wp-block-paragraph\">Suppose a person searches for caf\u00e9 and your corpus accommodates CAF\u00c9, or they sort stra\u00dfe and also you\u2019ve saved STRASSE. To make these rely as matches, you want a canonical kind that erases case distinctions, in order that two strings which differ solely in case evaluate equal. That kind is case folding, and it reveals up wherever textual content is matched quite than displayed: engines like google, regex (?i) flags, case-insensitive usernames and hostnames.<\/p>\n<p class=\"wp-block-paragraph\">It\u2019s a primary operation, however at GitHub we run it so much. Blackbird, GitHub\u2019s code search engine, indexes over 180 million repositories\u2014greater than 480TB of supply code. Each byte is case-folded earlier than we extract ngrams and construct the index, and for each potential question end result, one other (implicit or specific) case folding operation is required to find matches. At that scale, the pace of even a primary operation begins to matter.<\/p>\n<p class=\"wp-block-paragraph\">This put up is about how we made it quick, and it begins someplace counterintuitive: the largest win within the ASCII quick path got here from eradicating an optimization, not including one. It seems to be quicker to comb the entire buffer with no branches than to cease early on the first non-ASCII byte. We open-sourced the end result as a Rust crate referred to as casefold.<\/p>\n<h2 id=\"h-folding-is-not-lowercasing\" class=\"wp-block-heading\">Folding shouldn&#8217;t be lowercasing<\/h2>\n<p class=\"wp-block-paragraph\">It&#8217;s tempting to achieve for str::to_lowercase, however lowercasing and folding are completely different operations with completely different targets:<\/p>\n<p class=\"wp-block-paragraph\">Lowercasing is for show, and it\u2019s locale- and context-sensitive: Greek closing sigma lowercases to \u03c2 on the finish of a phrase and \u03c3 elsewhere, and Turkish I lowercases in another way than English I. Case folding is for comparability, and it\u2019s intentionally context-free and locale-independent. The purpose is a relation that stays steady and symmetric, in order that if A folds to match B, B folds to match A in any locale. The Unicode Character Database ships an specific CaseFolding.txt for precisely that.<\/p>\n<p class=\"wp-block-paragraph\">The 2 operations diverge on actual characters\u2014\u00df, \u0130, closing sigma\u2014which is why lowercasing as a stand-in silently produces flawed matches. This crate implements solely the easy (1-to-1) folds\u2014statuses C and S in CaseFolding.txt\u2014and never the multi-character \u201cfull\u201d folds (\u00df \u2192 ss) or Turkic locale folds (the dotted \u0130). This isn\u2019t an uncommon selection: frequent instruments and regex engines like ripgrep make the identical restriction, and being constant throughout instruments is essential.<\/p>\n<h2 id=\"h-the-counterintuitive-core-don-t-stop-early\" class=\"wp-block-heading\">The counterintuitive core: Don\u2019t cease early<\/h2>\n<p class=\"wp-block-paragraph\">We deal largely with supply code, so the textual content we fold is overwhelmingly ASCII and making it run at reminiscence pace is the only most essential factor we will do. Every little thing else simply has to maintain the uncommon non-ASCII path from spoiling it.<\/p>\n<p class=\"wp-block-paragraph\">The fold of an ASCII letter is trivial\u2014A..=Z map to a..=z, every little thing else is unchanged\u2014so the ASCII go is actually simply \u201csweep the buffer, lowercase in place.\u201d Ask any LLM for it and also you may get one thing like this:<\/p>\n<div class=\"wp-block-code-wrapper\">\nlet bytes = s.as_bytes_mut();<br \/>\nfor (i, b) in bytes.iter_mut().enumerate() {<br \/>\n    if *b &gt;= 0x80 {<br \/>\n        break; \/\/ non-ASCII at index i: hand the remaining to the Unicode path<br \/>\n    }<br \/>\n    if b.is_ascii_uppercase() {<br \/>\n        *b += 32; \/\/ &#8216;A&#8217;..=&#8217;Z&#8217; \u2192 &#8216;a&#8217;..=&#8217;z&#8217;<br \/>\n    }<br \/>\n}\n<\/div>\n<p class=\"wp-block-paragraph\">It appears to be like excellent: do a budget byte work, and the moment you hit a non-ASCII byte, break and let the \u201cactual\u201d Unicode path take over: \u201csolely do a budget work till you need to.\u201d On an Apple M4 this runs at about 3 GiB\/s. That sounds high-quality in isolation, however it&#8217;s greater than 15\u00d7 in need of \u201coptimum\u201d due to the if branches.<\/p>\n<p class=\"wp-block-paragraph\">Let\u2019s delete each department, line by line:<\/p>\n<p>if b &gt;= 0x80 { break } \u2192 don\u2019t cease in any respect. ORevery byte into an accumulator and check it as soon as, after the loop: high_bit_acc |= *b. Similar info (was there any non-ASCII byte?), zero branches within the physique.<\/p>\n<p>The A..=Z vary check \u2192 make it arithmetic. b.wrapping_sub(b&#8217;A&#8217;) &lt; 26 is true precisely for A..=Z (some other byte wraps to \u2265 26), yielding a 0\/1 masks with no department.<\/p>\n<p>The conditional write \u2192 fold the masks into the shop.| (is_upper &lt;&lt; 5)units bit 5\u2014turning an upper-case letter lower-case and being a no-op on every little thing else\u2014the byte is all the time written, by no means branched on.<\/p>\n<p class=\"wp-block-paragraph\">What\u2019s left has no department in its physique and no early exit:<\/p>\n<div class=\"wp-block-code-wrapper\">\nlet mut high_bit_acc: u8 = 0;<br \/>\nfor b in &amp;mut bytes = u8::from(is_upper) &lt;&lt; 5; \/\/ set bit 5 \u2192 lowercase, else no-op <\/p>\n<p>if high_bit_acc &amp; 0x80 == 0 {<br \/>\n    return bytes; \/\/ pure ASCII: already folded in place, no second buffer<br \/>\n}\n<\/p><\/div>\n<p class=\"wp-block-paragraph\">A loop with no data-dependent management movement is trivially vectorizable: LLVM emits 16-byte-at-a-time NEON and the entire thing runs at &gt; 45 GiB\/s\u2014basically reminiscence bandwidth. And we come out of the go already realizing, from high_bit_acc, whether or not there\u2019s any non-ASCII work left to do.<\/p>\n<p class=\"wp-block-paragraph\">How a lot did every step matter? Measuring the cumulative ladder on pure ASCII (Apple M4, 5.7 KB buffer):<\/p>\n<figure class=\"wp-block-table\">Model\u00a0Throughput\u00a0Vectorized?\u00a0naive (break + department check)\u00a03.1 GiB\/s\u00a0no (0 vector\u00a0instrs)\u00a0\u2192 branchless check\/write,\u00a0preserve\u00a0break\u00a02.6 GiB\/s\u00a0no (0 vector\u00a0instrs)\u00a0\u2192 drop the early-exit break\u00a07.6 GiB\/s\u00a0partially\u00a0(25 vector\u00a0instrs)\u00a0\u2192 branchless check + write (the loop)\u00a0&gt;45\u00a0GiB\/s\u00a0absolutely (41 vector\u00a0instrs)\u00a0<\/figure>\n<p class=\"wp-block-paragraph\">The early-exit is what gates vectorization: preserve the break however make the physique completely branch-free and you continue to get zero vector directions (~2.6 GiB\/s); a data-dependent loop exit is sufficient by itself to maintain the loop scalar. Solely as soon as the break is gone can the compiler vectorize. The ultimate step\u2014making the upper-case fold branchless\u2014then turns {a partially} vectorized loop (which nonetheless compiles the conditional retailer to a compare-blend-masked-store, ~7.6 GiB\/s) into the straight-line arithmetic that hits reminiscence bandwidth.<\/p>\n<figure class=\"wp-block-table\">Be aware: Branchless is a pessimization in scalar code. Look once more on the desk: making the physique branchless whereas preserving the break (2.6 GiB\/s) is definitely slower than the naive branchy loop (3.1 GiB\/s). The asm explains why. The branchy model solely shops a byte when it truly adjustments one; its conditional strbis skipped for each lowercase letter, digit and area (the overwhelming majority of actual textual content), and the well-predicted department that guards it&#8217;s almost free. The branchless model replaces that not often taken retailer with an unconditional strbevery iteration, writing again all ~5,700 bytes as a substitute of simply the handful of upper-case ones. Further write site visitors for no profit. Branchless-write solely wins as soon as the loop vectorizes, as a result of then the shop turns into a single 16-byte vector write no matter content material, and the per-byte price disappears. The lesson: a branchless physique is price it solely because the enabler for vectorization. By itself, in scalar code, it could possibly price you.<\/figure>\n<p class=\"wp-block-paragraph\">There\u2019s additionally a center floor, and it\u2019s what normal libraries use. As a substitute of testing one byte at a time, [u8]::is_ascii scans a machine phrase at a time\u2014on a 64-bit goal it exams 16 bytes per iteration by OR-ing two u64 lanes and checking all their excessive bits with a single &amp; 0x8080_8080_8080_8080 masks. You&#8217;ll be able to construct the ASCII quick path on high of that: chunk-scan to search out the ASCII prefix, then run the branchless (vectorizable) convert over it. That retains the early-exit capability\u2014it nonetheless bails on the primary non-ASCII block\u2014whereas letting each halves go quick. The catch is that it reads the info twice (as soon as to scan, as soon as to transform), touchdown at about 23 GiB\/s\u2014roughly half of the single-pass branchless sweep, and ~7\u00d7 the naive break loop. A strong, general-purpose default; simply not absolutely the ceiling if you management the entire loop and might fold detection and conversion into one branch-free go.<\/p>\n<p class=\"wp-block-paragraph\">Wouldn\u2019t fusing the 2 passes be quicker? It\u2019s the plain subsequent thought: preserve the chunked early-exit however convert every 16-byte block proper after you\u2019ve confirmed it\u2019s ASCII, studying the info solely as soon as. Measured, it\u2019s ~2.6\u00d7 slower\u20148.7 GiB\/s versus the two-pass 23. The internal block convert nonetheless vectorizes to a single 16-byte op, however now there\u2019s a data-dependent early-exit department each 16 bytes, and that department pins the loop to 1 block at a time: the compiler doesn\u2019t unroll or software-pipeline throughout blocks, and every iteration pays the complete load\u2192check\u2192department\u2192convert\u2192retailer latency with nothing to cover it behind. Cut up into two passes, each is clear: the scan is a branch-light, store-free phrase scan that races via reminiscence, and the convert is the fully-vectorized branch-free sweep at &gt;45 GiB\/s. Two quick, branch-free passes beat one branchy fused go\u2014regardless that the fused model touches the info half as many occasions. It\u2019s the identical lesson yet another time: within the sizzling loop, the department is the enemy.<\/p>\n<h2 id=\"h-avoiding-the-heap\" class=\"wp-block-heading\">Avoiding the heap<\/h2>\n<p class=\"wp-block-paragraph\">Forty-5 GiB\/s additionally means doing zero pointless allocation. simple_fold takes the enter String by worth, proudly owning the heap buffer it could possibly mutate and return it. If the OR-accumulator\u2019s excessive bit was clear, the enter was pure ASCII already folded in place. We hand the identical allocation straight again, no second buffer and no copy. In any other case, we memchrto the primary non-ASCII byte and scan the tail from there, leaving the output buffer unallocated (a null write cursor) till we hit a personality that folds to completely different bytes. Textual content whose multibyte content material by no means folds\u2014CJK, Hangul, Kana, Arabic, Hebrew, symbols\u2014additionally returns the unique allocation untouched, by no means copying a byte.<\/p>\n<p class=\"wp-block-paragraph\">Why a second buffer quite than rewriting in place just like the ASCII go? As a result of folding could make the string longer: virtually each fold preserves the UTF-8 size or shrinks it, however two outliers develop\u2014U+023A (\u023a) and U+023E (\u2c7f) are 2 bytes every but fold to 3-byte characters (\u2c65, \u0240). As soon as one seems, the output now not matches within the enter\u2019s bytes, and we want someplace new to jot down.<\/p>\n<p class=\"wp-block-paragraph\">We allocate that buffer as soon as, sized for the worst case, quite than rising it as extra folds seem. Incremental reserve calls would imply re-checking capability, sometimes reallocating, copying every little thing written to date, and juggling additional size\/capability bookkeeping; a single up-front allocation lets a uncooked write cursor run straight to the top with none of that. And because the cursor is nulluntil that first rising\/altering fold, it doubles because the \u201chave we allotted the additional buffer but?\u201d flag.<\/p>\n<p class=\"wp-block-paragraph\">Sizing it wants a sure on development, and those self same two outliers give it: each 2 enter bytes yield at most 3 output bytes, capping the output at 1.5\u00d7 the enter\u2014precisely the capability we reserve:<\/p>\n<div class=\"wp-block-code-wrapper\">\nout = Vec::with_capacity(bytes.len() + bytes.len() \/ 2 + 4);\n<\/div>\n<p class=\"wp-block-paragraph\">After that the loop writes via a uncooked pointer with no capability checks and calls set_len as soon as on the finish. Two extra particulars preserve it branch-light. The run of unchanged bytes between two folds is moved with a single copy_nonoverlapping quite than byte by byte. And every fold unconditionally writes all 4 bytes of a little-endian phrase earlier than bumping the cursor by solely the folded size (1\u20134)\u2014dropping a department on the output size from the recent path, with the + 4 within the reservation because the headroom that makes the ultimate character\u2019s over-store protected.<\/p>\n<h2 id=\"h-making-unicode-cheap-too\" class=\"wp-block-heading\">Making Unicode low-cost too<\/h2>\n<p class=\"wp-block-paragraph\">When a personality does fold, we nonetheless don\u2019t wish to fall off a cliff\u2014decode UTF-8, hash lookup, re-encode. Unicode 16.0 has 1484 simple-fold mappings, however they\u2019re a really sparse and really structured relation. 4 observations shrink them to 1776 bytes and let the fold run with out ever decoding a full character.<\/p>\n<p class=\"wp-block-paragraph\">Even on the non-ASCII path, the overwhelming majority of characters don&#8217;t fold. The recent operation isn\u2019t actually \u201cfold this character,\u201d it\u2019s \u201cdoes this character fold?\u201d Nearly all the time no. The desk has to make that damaging check as low-cost as potential; the precise folding is the uncommon case on an already-rare path. That precedence is what shapes the structure under\u2014the web page bitmap exists exactly so a non-folding character is rejected in a single bit check, straight from its main UTF-8 bytes, with out decoding or scanning something.<\/p>\n<p class=\"wp-block-paragraph\">That is precisely why a HashMap is the flawed form for the job, not only a larger one. A hash map is optimized for the hit: it finds a gift key in roughly one probe, and solely spends additional work (extra probes, full key comparability) when load issue or collisions chunk. However our workload is dominated by misses\u2014characters that aren\u2019t within the desk in any respect\u2014and a miss is a hash map\u2019s least favourite question: it nonetheless has to hash the important thing, bounce to a bucket, and stroll the probe sequence far sufficient to show absence.<\/p>\n<h2 id=\"h-foldable-code-points-cluster-into-64-code-point-pages\" class=\"wp-block-heading\">Foldable code factors cluster into 64-code-point \u201cpages\u201d<\/h2>\n<p class=\"wp-block-paragraph\">Foldable code factors bunch collectively. Slice the code area into 64-code-point \u201cpages\u201d and the ~1484 folds contact simply 59 of ~1960 potential pages. A one-bit-per-page presence bitmap solutions the damaging check by itself: a transparent bit is a definitive \u201cno fold\u201d\u2014copy via, performed\u2014which is what makes fold-free scripts low-cost. Solely on a set bit will we seek the advice of a second construction, a cumulative-popcount aspect desk that ranks the web page (what number of populated pages precede it) to search out its slice of entries, storing nothing for the ~1900 empty pages.<\/p>\n<div class=\"wp-block-code-wrapper\">\nlet (word_idx, bit_idx, c_len) = if lead &lt; 0xE0 {<br \/>\n    (0usize, lead &amp; 0x1F, 2usize) \/\/ 2-byte: phrase 0<br \/>\n} else if lead &lt; 0xF0 {<br \/>\n    ((lead &amp; 0x0F) as usize, bytes[read + 1] &amp; 0x3F, 3) \/\/ 3-byte: phrase = nibble <\/p>\n<p>} else  (bytes[read + 1] &amp; 0x3F) as usize,<br \/>\n        bytes[read + 2] &amp; 0x3F,<br \/>\n        4usize,<br \/>\n    ) \/\/ 4-byte: merge 2 bytes<br \/>\n;<br \/>\n\/\/ reject with out decoding: clear bit \u21d2 no fold<br \/>\nif word_idx &gt;= PAGE_BITMAP.len() || (PAGE_BITMAP[word_idx] &gt;&gt; bit_idx) &amp; 1 == 0 {<br \/>\n    learn += c_len;<br \/>\n    proceed;<br \/>\n}\n<\/p><\/div>\n<p class=\"wp-block-paragraph\">As a result of word_idxdepends solely on the lead byte (and, for four-byte sequences, the primary continuation byte), the bitmap load might be issued early.<\/p>\n<h2 id=\"h-within-a-page-folds-come-in-runs\" class=\"wp-block-heading\">Inside a web page, folds are available in runs<\/h2>\n<p class=\"wp-block-paragraph\">A set web page bit tells us one thing on this web page folds, however not which code factors or to what. The plain encoding is one entry per foldable code level\u2014however that&#8217;s each cumbersome and sluggish to look: a web page can maintain dozens of folds, and we\u2019d should scan all of them to search out the one matching the present code level. The construction of the info rescues us once more. Adjoining code factors overwhelmingly share the identical delta to their fold: A\u2013Z all map +32, and Latin Prolonged is filled with alternating runs like 0x0100, 0x0102, 0x0104, \u2026 the place each second code level folds. As a substitute of per-code-point entries we retailer runs\u2014begin, finish, stride, delta\u2014and a 1-bit stride flag covers each the contiguous and the every-other case. This interval compression collapses the ~1484 particular person folds into simply 238 runs throughout the 59 pages (\u22484 per web page), leaving the within-page search solely a handful of entries to have a look at as a substitute of dozens. This range-with-delta encoding (together with the stride trick) is borrowed from Go\u2019s unicode package deal, whose CaseRange data retailer a Lo\/Hello vary plus per-case deltas, with an UpperLower sentinel marking the alternating blocks. Runs are cut up on the web page boundaries so a run by no means straddles two pages.<\/p>\n<h2 id=\"h-a-run-record-is-two-clean-bytes\" class=\"wp-block-heading\">A run file is 2 clear bytes<\/h2>\n<p class=\"wp-block-paragraph\">With each endpoints inside one web page they slot in 6 bits, cut up throughout two arrays: RUN_END_LOW[&#8220;i&#8220;] = finish &amp; 0x3F (the scan key) and RUN_START_STRIDE[&#8220;i&#8220;] = (begin &amp; 0x3F) | ((stride \u2212 1) &lt;&lt; 6) (learn solely on a success). As a result of every secret&#8217;s one clear byte, the within-page search can go large: quite than evaluating cp &amp; 0x3F in opposition to the runs one by one, we load 8 end_low bytes right into a single u64 and check all of them without delay with one branchless SWAR step\u2014(chunk | 0x80\u202680) \u2212 broadcast(low) &amp; 0x80\u202680 units the highest bit of each lane whose secret&#8217;s \u2265 cp &amp; 0x3F. A single bit-scan of that masks (the keys are sorted, so the primary set lane is the run we wish) finds the slot. A web page holds ~4 runs on common; that one 8-wide evaluate virtually all the time resolves all the search in a single step. One unfortunate web page does maintain 30 runs, which places the evaluate inside a brief loop that strides eight keys at a time\u2014however that loop journeys at most a handful of occasions on precisely one web page in all of Unicode, and by no means on the frequent ones. Both means: no per-run department, and no code-point reconstruction wherever.<\/p>\n<div class=\"wp-block-code-wrapper\">\n\/\/\/ Offset of the primary run with `end_low &gt;= low_v` in a web page of `n` runs,<br \/>\n\/\/\/ or `n` if none. Scans 8 `end_low` bytes at a time through SWAR.<br \/>\n#[inline]<br \/>\nfn scan_end_low(lo: usize, n: usize, low_v: u8) -&gt; usize {<br \/>\n    const HIGH: u64 = 0x8080_8080_8080_8080;<br \/>\n    const ONES: u64 = 0x0101_0101_0101_0101;<br \/>\n    let bcast = (low_v as u64).wrapping_mul(ONES);<br \/>\n    let mut base = 0;<br \/>\n    whereas base &lt; n {<br \/>\n        \/\/ RUN_END_LOW is padded by 8 bytes so this learn is all the time in bounds.<br \/>\n        let chunk = u64::from_le_bytes(<br \/>\n            RUN_END_LOW[lo + base..lo + base + 8]<br \/>\n                .try_into()<br \/>\n                .anticipate(&#8220;8-byte slice&#8221;),<br \/>\n        );<br \/>\n        \/\/ `(b | 0x80) &#8211; low_v` retains its excessive bit iff `b &gt;= low_v` (no<br \/>\n        \/\/ cross-lane borrow). The primary set lane is the primary run `&gt;= low_v`.<br \/>\n        let ge = (chunk | HIGH).wrapping_sub(bcast) &amp; HIGH;<br \/>\n        if ge != 0 {<br \/>\n            let j = base + (ge.trailing_zeros() \/ 8) as usize;<br \/>\n            return if j &lt; n { j } else { n };<br \/>\n        }<br \/>\n        base += 8;<br \/>\n    }<br \/>\n    n<br \/>\n}<br \/>\n= low_v` (no<br \/>\n        \/\/ cross-lane borrow). The primary set lane is the primary run `&gt;= low_v`.<br \/>\n        let ge = (chunk | HIGH).wrapping_sub(bcast) &amp; HIGH;<br \/>\n        if ge != 0 {<br \/>\n            let j = base + (ge.trailing_zeros() \/ 8) as usize;<br \/>\n            return if j &lt; n { j } else { n };<br \/>\n        }<br \/>\n        base += 8;<br \/>\n    }<br \/>\n    n<br \/>\n}&#8221; tabindex=&#8221;0&#8243; function=&#8221;button&#8221;&gt;<\/div>\n<h2 id=\"h-folding-is-a-little-endian-byte-addition\" class=\"wp-block-heading\">Folding is a little-endian byte addition<\/h2>\n<p class=\"wp-block-paragraph\">On a little-endian machine the folded character\u2019s UTF-8 bytes, learn as a u32, equal the supply bytes (as a u32) plus a per-run fixed. A parallel BYTE_DELTA[i] desk then turns the entire fold right into a masked load, one wrapping_add, and a 4-byte retailer:<\/p>\n<div class=\"wp-block-code-wrapper\">\nlet phrase = u32::from_le_bytes(next_four_bytes) &amp; length_mask; \/\/ preserve this char&#8217;s bytes<br \/>\nlet folded = phrase.wrapping_add(BYTE_DELTA[i]); \/\/ the fold, as one byte add<br \/>\nwrite_u32_le(dst, folded); \/\/ retailer all 4 bytes&#8230;<br \/>\ndst += utf8_len(folded); \/\/ &#8230;advance by the folded size\n<\/div>\n<p class=\"wp-block-paragraph\">Each lengths in that snippet\u2014the length_mask for the supply character and the advance by the folded size for the vacation spot\u2014come from yet another tiny trick. A UTF-8 sequence\u2019s size is fastened by the highest 4 bits of its lead byte, letting the 16 potential lengths pack one nibble every right into a single 64-bit fixed (0x4322_1111_1111_1111); the size is then a shift and a masks, (LEN_BITS &gt;&gt; (4 * (lead &gt;&gt; 4))) &amp; 0xF\u2014no if chain, no desk reminiscence, nothing for the predictor to get flawed. (A rely main ones\u2014(!lead).leading_zeros()\u2014would additionally work, since a lead byte carries one main 1-bit per byte of the sequence.)<\/p>\n<div class=\"wp-block-code-wrapper\">\n\/\/\/ Variety of bytes within the UTF-8 sequence whose lead byte is `lead`.<br \/>\n#[inline]<br \/>\npub fn utf8_len(lead: u8) -&gt; usize {<br \/>\n    const UTF8_LEN_BY_LEAD: u64 = 0x4322_1111_1111_1111;<br \/>\n    ((UTF8_LEN_BY_LEAD &gt;&gt; (4 * (lead &gt;&gt; 4))) &amp; 0xF) as usize<br \/>\n}\n<\/div>\n<p class=\"wp-block-paragraph\">As a result of we advance by the folded size, this even handles length-changing folds\u2014U+212A KELVIN SIGN (3 bytes) \u2192 ok (1 byte), or U+023A \u023a (2 bytes) \u2192 U+2C65 \u2c65 (3 bytes)\u2014by writing fewer or extra bytes than have been learn. That\u2019s the half we imagine is genuinely new: each different folder we checked out\u2014ICU, Go\u2019s unicode, Rust\u2019s regex, CPython, glibc\u2014decodes UTF-8 to a code level, applies the fold there, and re-encodes (even SIMD folders decode first). Doing the arithmetic in byte area skips each the decode and the encode, which is precisely why this path can outrun a hash map that already has the reply tabulated\u2014the hash map nonetheless has to decode its key and encode its end result. The byte-space arithmetic assumes the enter is well-formed, shortest-form UTF-8\u2014each code level encoded with the minimal variety of bytes. Studying the supply bytes as a u32and including a per-run delta solely lands on the proper folded encoding when the supply is in canonical kind; an overlong encoding (a code level padded into extra bytes than mandatory, e.g. \/ as 0xC0 0xAF) has a special byte sample and would break thelength_mask and the delta arithmetic. This isn&#8217;t an actual restriction in Rust\u2014&amp;str\/String are assured to carry legitimate UTF-8, which by definition rejects overlong sequences\u2014however a caller feeding uncooked bytes from elsewhere should validate (or in any other case normalize) them first.<\/p>\n<h2 id=\"h-the-ascii-shortcut-in-the-tail-loop\" class=\"wp-block-heading\">The ASCII shortcut within the tail loop<\/h2>\n<p class=\"wp-block-paragraph\">Another shortcut rounds out the tail loop. Keep in mind the primary go already lowercased each ASCII byte, so when the scan meets an ASCII byte within the tail it advances a single byte and strikes on\u2014no web page probe, no desk contact in any respect. And it doesn\u2019t copy that byte both: unmodified bytes (ASCII and non-folding multibyte alike) aren\u2019t moved one by one. The scan simply retains strolling till it reaches a personality that really folds, then flushes the entire unchanged run between the final fold and this one with a single copy_nonoverlapping. Combined textual content\u2014CJK with ASCII areas and punctuation, or code with the occasional accented identifier\u2014subsequently races via the ASCII filler and solely consults the bitmap for real multibyte characters, copying in bulk quite than byte by byte.<\/p>\n<h2 id=\"h-putting-it-together-the-whole-table\" class=\"wp-block-heading\">Placing it collectively: the entire desk<\/h2>\n<figure class=\"wp-block-table\">Part\u00a0Bytes\u00a0PAGE_BITMAP (1 bit per 64-cp web page)\u00a0248\u00a0POPCNT_SAMPLES (cumulative\u00a0popcount)\u00a032\u00a0PAGE_OFFSET (per populated web page)\u00a060\u00a0RUN_END_LOW (scan key, finish &amp; 0x3F, +8 pad)\u00a0246\u00a0RUN_START_STRIDE (begin &amp; 0x3F | stride)\u00a0238\u00a0BYTE_DELTA (little-endian fold delta per run)\u00a0952\u00a0Whole\u00a01776\u00a0<\/figure>\n<p class=\"wp-block-paragraph\">That\u2019s 9.6 bits per fold entry, over half of it the BYTE_DELTA aspect desk we commerce for the decode-free path; the index + run data alone are ~4.4 bits\/entry.<\/p>\n<p class=\"wp-block-paragraph\">Subsequent to the plain options, that 1776 bytes is an order of magnitude or extra smaller\u2014and in contrast to most of them, it by no means decodes a personality:<\/p>\n<figure class=\"wp-block-table\">Illustration\u00a0SizeNa\u00efve\u00a0[(u32, u32); 1484]\u00a0~11.6 KB\u00a0regex-syntax\u2019s\u00a0case_folding_simple\u00a0desk\u00a0~70 KB\u00a0Go\u2019s\u00a0unicode.SimpleFold\u00a0(orbit + ASCII + ranges)\u00a0~7.3 KB\u00a0A runtime\u00a0HashMap\u00a0~17 KB\u00a0This crate (paged bitmap + packed runs)\u00a01776 B\u00a0<\/figure>\n<h2 id=\"h-where-it-lands-against-the-alternatives\" class=\"wp-block-heading\">The place it lands in opposition to the options<\/h2>\n<p class=\"wp-block-paragraph\">On the frequent case, ASCII, folding runs at reminiscence bandwidth (&gt;45 GiB\/s), greater than an order of magnitude forward of different actual folders and greater than 50% quicker than the (non-equivalent) str::to_lowercase operate. To get a tough \u201chigher sure\u201d for the non-ASCII case, we measured the optimized Utf8 decoding + encoding spherical journey with out performing any precise case folding utilizing the simdutf crate. This experiment achieves persistently about 2GB\/sec and is simply about twice as quick than our resolution for the worst case all-folding enter. A naive hash map trails every little thing on all workloads.<\/p>\n<p class=\"wp-block-paragraph\">The three columns are actual case folders that produce similar output: simple_fold (this crate), simd_normalizer (the simd-normalizer crate), and HashMap (naive CaseFolding.txt lookup). The workload rows are chosen to simulate completely different eventualities from typical to worst case:<\/p>\n<figure class=\"wp-block-table\">Workload (enter measurement)\u00a0simple_fold\u00a0simd_normalizer\u00a0HashMap (byte path)\u00a0Pure ASCII (5.7 KB)\u00a0&gt;45\u00a0GiB\/s\u00a01.21 GiB\/s\u00a0213 MiB\/s\u00a0Chinese language\/Japanese\/Korean, no folds (8.1 KB)\u00a02.95 GiB\/s\u00a01.97 GiB\/s\u00a0558 MiB\/s\u00a0Symbols \/ Myanmar, no folds (9.0 KB)\u00a02.96 GiB\/s\u00a01.56 GiB\/s\u00a0410 MiB\/s\u00a0Worst case: Latin\/Greek\/Cyrillic (Unicode U+0000\u2013U+FFFF), all folding (8.8 KB)\u00a0869 MiB\/s\u00a0922 MiB\/s\u00a0334 MiB\/s\u00a0Size-changing folds (1.7 KB)\u00a01.26 GiB\/s\u00a0716 MiB\/s\u00a0233 MiB\/s\u00a0<\/figure>\n<p class=\"wp-block-paragraph\">Deal with absolutely the figures as illustrative, not moveable: the entire design leans on auto-vectorization, SWAR, and little-endian byte arithmetic, so the numbers\u2014and even the ratios between rows\u2014can shift considerably on a special microarchitecture (a wider or narrower vector unit, completely different reminiscence bandwidth, a big-endian goal, x86 vs ARM).<\/p>\n<p class=\"wp-block-paragraph\">Extra particulars might be discovered within the efficiency part of the README.<\/p>\n<h2 id=\"h-take-this-with-you\" class=\"wp-block-heading\">Take this with you<\/h2>\n<p class=\"wp-block-paragraph\">Case folding is about as primary as textual content operations get, which is precisely why it was definitely worth the effort: we run it throughout each byte we index. The wins got here from two concepts that each minimize in opposition to intuition\u2014sweep the entire buffer branch-free as a substitute of stopping early, and do the fold as byte-space arithmetic as a substitute of decoding to a code level. Collectively they let the frequent case run at reminiscence bandwidth and the uncommon fold run and not using a decode, in a desk sufficiently small (1776 bytes) to remain resident. The decode-free byte-space fold is the piece we imagine is genuinely new; it\u2019s why this path can beat a hash map that already has the reply.<\/p>\n<p class=\"wp-block-paragraph\">There\u2019s absolutely extra to search out right here, and we\u2019d wish to see it. The crate is casefold; the generated desk and full design notes dwell alongside the supply.<\/p>\n<div class=\"mt-8 mb-8 mb-md-0\">\n<h2 class=\"h5-mktg\">\n\t\tWritten by\t<\/h2>\n<div class=\"author-bio__content\">\n<div class=\"author-bio__avatar\">\n<p>\t\t\t\t\t<img class=\"d-block circle\" src=\"https:\/\/avatars.githubusercontent.com\/u\/7701635?v=4&amp;s=200\" alt=\"Alexander Neubeck\" width=\"80\" height=\"80\" loading=\"lazy\" decoding=\"async\"\/><\/p><\/div>\n<div class=\"author-bio__bio f4 lh-default\">\n<p>Principal Software program Engineer, GitHub<\/p>\n<\/p><\/div><\/div>\n<div class=\"author-bio__content\">\n<div class=\"author-bio__avatar\">\n<p>\t\t\t\t\t<img class=\"d-block circle\" src=\"https:\/\/avatars.githubusercontent.com\/u\/1234453?v=4&amp;s=200\" alt=\"Greg Orzell\" width=\"80\" height=\"80\" loading=\"lazy\" decoding=\"async\"\/><\/p><\/div>\n<div class=\"author-bio__bio f4 lh-default\">\n<p>Principal Software program Engineer<\/p>\n<\/p><\/div><\/div><\/div>\n<\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/github.blog\/engineering\/architecture-optimization\/dont-stop-early-case-folding-source-code-at-memory-speed\/\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Suppose a person searches for caf\u00e9 and your corpus accommodates CAF\u00c9, or they sort stra\u00dfe and also you\u2019ve saved STRASSE. To make these rely as matches, you want a canonical kind that erases case distinctions, in order that two strings which differ solely in case evaluate equal. That kind is case folding, and it reveals [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3145,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080","fifu_image_alt":"","jnews-multi-image_gallery":[],"jnews_single_post":[],"jnews_primary_category":[],"jnews_override_bookmark_settings":[],"jnews_social_meta":[],"jnews_override_counter":[],"footnotes":""},"categories":[5],"tags":[3562,362,1337,718,554,2117,3295,681],"class_list":["post-3143","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developer-ai-open-source-ecosystem","tag-casefolding","tag-code","tag-dont","tag-early","tag-memory","tag-source","tag-speed","tag-stop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Do not cease early: Case-folding supply code at reminiscence pace - Future News 24<\/title>\n<meta name=\"description\" content=\"How a branch-free loop and byte-space arithmetic let GitHub case-fold every byte of code search at &gt;45 GiB\/s on a single core.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Do not cease early: Case-folding supply code at reminiscence pace - Future News 24\" \/>\n<meta property=\"og:description\" content=\"How a branch-free loop and byte-space arithmetic let GitHub case-fold every byte of code search at &gt;45 GiB\/s on a single core.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/\" \/>\n<meta property=\"og:site_name\" content=\"Future News 24\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-31T16:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-01T16:59:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080\" \/>\n<meta name=\"author\" content=\"Future News 24\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Future News 24\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"21 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/\"},\"author\":{\"name\":\"Future News 24\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#\\\/schema\\\/person\\\/cecad1bde21cfc357cf70128144d6c83\"},\"headline\":\"Do not cease early: Case-folding supply code at reminiscence pace\",\"datePublished\":\"2026-07-31T16:00:00+00:00\",\"dateModified\":\"2026-08-01T16:59:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/\"},\"wordCount\":4290,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/generic-github-invertocat-logo.png?fit=1920%2C1080\",\"keywords\":[\"Casefolding\",\"Code\",\"Dont\",\"Early\",\"Memory\",\"source\",\"Speed\",\"stop\"],\"articleSection\":[\"Developer AI &amp; Open-Source Ecosystem\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/\",\"url\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/\",\"name\":\"Do not cease early: Case-folding supply code at reminiscence pace - Future News 24\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/generic-github-invertocat-logo.png?fit=1920%2C1080\",\"datePublished\":\"2026-07-31T16:00:00+00:00\",\"dateModified\":\"2026-08-01T16:59:28+00:00\",\"description\":\"How a branch-free loop and byte-space arithmetic let GitHub case-fold every byte of code search at &gt;45 GiB\\\/s on a single core.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/#primaryimage\",\"url\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/generic-github-invertocat-logo.png?fit=1920%2C1080\",\"contentUrl\":\"https:\\\/\\\/github.blog\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/generic-github-invertocat-logo.png?fit=1920%2C1080\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/2026\\\/07\\\/31\\\/dont-stop-early-case-folding-source-code-at-memory-speed\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/futurenews24.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Do not cease early: Case-folding supply code at reminiscence pace\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#website\",\"url\":\"https:\\\/\\\/futurenews24.com\\\/\",\"name\":\"Future News 24\",\"description\":\"The Smart Hub for AI and Next-Gen Innovation\",\"publisher\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/futurenews24.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#organization\",\"name\":\"Future News 24\",\"url\":\"https:\\\/\\\/futurenews24.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/futurenews24.com\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/fn24-favicon.png\",\"contentUrl\":\"https:\\\/\\\/futurenews24.com\\\/wp-content\\\/uploads\\\/2026\\\/06\\\/fn24-favicon.png\",\"width\":250,\"height\":250,\"caption\":\"Future News 24\"},\"image\":{\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/futurenews24.com\\\/#\\\/schema\\\/person\\\/cecad1bde21cfc357cf70128144d6c83\",\"name\":\"Future News 24\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d57f07142d73cb5503ab2446ea7bc9ef3d0a5ba378d64a6157692311e42bf097?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d57f07142d73cb5503ab2446ea7bc9ef3d0a5ba378d64a6157692311e42bf097?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d57f07142d73cb5503ab2446ea7bc9ef3d0a5ba378d64a6157692311e42bf097?s=96&d=mm&r=g\",\"caption\":\"Future News 24\"},\"sameAs\":[\"https:\\\/\\\/futurenews24.com\"],\"url\":\"https:\\\/\\\/futurenews24.com\\\/index.php\\\/author\\\/mridulpahuja20\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Do not cease early: Case-folding supply code at reminiscence pace - Future News 24","description":"How a branch-free loop and byte-space arithmetic let GitHub case-fold every byte of code search at &gt;45 GiB\/s on a single core.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/","og_locale":"en_US","og_type":"article","og_title":"Do not cease early: Case-folding supply code at reminiscence pace - Future News 24","og_description":"How a branch-free loop and byte-space arithmetic let GitHub case-fold every byte of code search at &gt;45 GiB\/s on a single core.","og_url":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/","og_site_name":"Future News 24","article_published_time":"2026-07-31T16:00:00+00:00","article_modified_time":"2026-08-01T16:59:28+00:00","og_image":[{"url":"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080","type":"","width":"","height":""}],"author":"Future News 24","twitter_card":"summary_large_image","twitter_image":"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080","twitter_misc":{"Written by":"Future News 24","Est. reading time":"21 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/#article","isPartOf":{"@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/"},"author":{"name":"Future News 24","@id":"https:\/\/futurenews24.com\/#\/schema\/person\/cecad1bde21cfc357cf70128144d6c83"},"headline":"Do not cease early: Case-folding supply code at reminiscence pace","datePublished":"2026-07-31T16:00:00+00:00","dateModified":"2026-08-01T16:59:28+00:00","mainEntityOfPage":{"@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/"},"wordCount":4290,"commentCount":0,"publisher":{"@id":"https:\/\/futurenews24.com\/#organization"},"image":{"@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/#primaryimage"},"thumbnailUrl":"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080","keywords":["Casefolding","Code","Dont","Early","Memory","source","Speed","stop"],"articleSection":["Developer AI &amp; Open-Source Ecosystem"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/","url":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/","name":"Do not cease early: Case-folding supply code at reminiscence pace - Future News 24","isPartOf":{"@id":"https:\/\/futurenews24.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/#primaryimage"},"image":{"@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/#primaryimage"},"thumbnailUrl":"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080","datePublished":"2026-07-31T16:00:00+00:00","dateModified":"2026-08-01T16:59:28+00:00","description":"How a branch-free loop and byte-space arithmetic let GitHub case-fold every byte of code search at &gt;45 GiB\/s on a single core.","breadcrumb":{"@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/#primaryimage","url":"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080","contentUrl":"https:\/\/github.blog\/wp-content\/uploads\/2026\/01\/generic-github-invertocat-logo.png?fit=1920%2C1080"},{"@type":"BreadcrumbList","@id":"https:\/\/futurenews24.com\/index.php\/2026\/07\/31\/dont-stop-early-case-folding-source-code-at-memory-speed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/futurenews24.com\/"},{"@type":"ListItem","position":2,"name":"Do not cease early: Case-folding supply code at reminiscence pace"}]},{"@type":"WebSite","@id":"https:\/\/futurenews24.com\/#website","url":"https:\/\/futurenews24.com\/","name":"Future News 24","description":"The Smart Hub for AI and Next-Gen Innovation","publisher":{"@id":"https:\/\/futurenews24.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/futurenews24.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/futurenews24.com\/#organization","name":"Future News 24","url":"https:\/\/futurenews24.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/futurenews24.com\/#\/schema\/logo\/image\/","url":"https:\/\/futurenews24.com\/wp-content\/uploads\/2026\/06\/fn24-favicon.png","contentUrl":"https:\/\/futurenews24.com\/wp-content\/uploads\/2026\/06\/fn24-favicon.png","width":250,"height":250,"caption":"Future News 24"},"image":{"@id":"https:\/\/futurenews24.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/futurenews24.com\/#\/schema\/person\/cecad1bde21cfc357cf70128144d6c83","name":"Future News 24","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d57f07142d73cb5503ab2446ea7bc9ef3d0a5ba378d64a6157692311e42bf097?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d57f07142d73cb5503ab2446ea7bc9ef3d0a5ba378d64a6157692311e42bf097?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d57f07142d73cb5503ab2446ea7bc9ef3d0a5ba378d64a6157692311e42bf097?s=96&d=mm&r=g","caption":"Future News 24"},"sameAs":["https:\/\/futurenews24.com"],"url":"https:\/\/futurenews24.com\/index.php\/author\/mridulpahuja20\/"}]}},"_links":{"self":[{"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/posts\/3143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/comments?post=3143"}],"version-history":[{"count":1,"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/posts\/3143\/revisions"}],"predecessor-version":[{"id":3144,"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/posts\/3143\/revisions\/3144"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/media\/3145"}],"wp:attachment":[{"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/media?parent=3143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/categories?post=3143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/futurenews24.com\/index.php\/wp-json\/wp\/v2\/tags?post=3143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}