$ the-wire · showcase
StringIO counts characters faster, replace_leading gets simpler
By RepoJournal · Filed · About Elixir & Phoenix · Composed from the cited sources · methodology
Two internal optimizations landed in elixir-lang/elixir, both preserving return values: StringIO's character counting now scans in wider chunks, and String.replace_leading/3 drops its prefix bookkeeping.
Scan StringIO character counts in seven-code-point chunks elixir-lang/elixir
Barna Kovacs' patch scans StringIO character counts in seven-byte ASCII chunks via a 56-bit mask, falling back to a seven-code-point UTF-8 step when the remaining count is at least 7, so mixed inputs advance past non-ASCII bytes and resume ASCII chunking before the remainder finishes in split_at_utf8/2. The pull request characterizes the result as "Faster or same speed" relative to the 32c1def4...
Simplify String.replace_leading/3 prefix matching elixir-lang/elixir
Clayton Gentry's change matches the pinned binary directly, removing the prefix and suffix size bookkeeping, and returns the original string immediately when no prefix matches instead of going through the replacement duplication call. Shape and return values of replace_leading/3 are unchanged.
Scan StringIO character counts in seven-code-point chunks (#16019) elixir-lang/elixir
The commit behind the StringIO chunking work, authored by preciz and attributed as "Scan StringIO character counts in seven-code-point chunks", is the merge point for that optimization.
Simplify String.replace_leading/3 prefix matching (#16018) elixir-lang/elixir
The commit for the replace_leading/3 simplification, credited to Clayton Gentry, closes out that refactor as described in the pull request.