{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreigifzd7esuedhwfglnnl7tk6nfmcgtwygq5skuzuailjbk6vbpdva",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mjxajrdr5hr2"
  },
  "path": "/t/blog-5x-speedup-changing-break-to-elemindex/13946#post_7",
  "publishedAt": "2026-04-20T18:39:47.000Z",
  "site": "https://discourse.haskell.org",
  "tags": [
    "Data.Text.Internal.ArrayUtils.memchr",
    "Add RULE from break to breakOn · Issue #695 · haskell/text · GitHub",
    "Search of a singleton needle should use memchr · Issue #696 · haskell/text · GitHub"
  ],
  "textContent": "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.\n\nYou 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.",
  "title": "[Blog] 5x speedup changing break to elemIndex!"
}