[Blog] 5x speedup changing break to elemIndex!
Haskell Community [Unofficial]
April 20, 2026
I think the migration from Text to ByteString could provide only marginal gains and probably was not worth it. UTF-8 decoding is implemented with SIMD instructions, so it is very fast, especially on the happy path. And one can use decodeLenient to skip decoding failures.
You could have looked inside Text to find ByteArray suitable for Data.Text.Internal.ArrayUtils.memchr (yes, suspiciously enough text already uses memchr). For a more ergonomic solution I’d welcome PRs for Add RULE from break to breakOn · Issue #695 · haskell/text · GitHub and Search of a singleton needle should use memchr · Issue #696 · haskell/text · GitHub.
Discussion in the ATmosphere