You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JS String.contains still scans ordinary text character by character #1637
The packed-Char boundary handling in #1628 is needed, but every ordinary string still takes the per-character startsWith loop. On main e5527d5, a real exported Bend contains(s: String, p: String) -> Bool takes 77-79 ms to reject a 1024-character almost-matching needle in one million ASCII characters (Bun 1.3.13, Linux x86-64). The UTF-16 packed-Char sentinel is U+DC00. When the haystack contains no such code unit, native includes can search without a false match inside a packed Char. I am testing that fast path while retaining the existing boundary walk whenever the sentinel occurs, including an astral pair containing U+DC00. This does not change the String API or the behavior of non-scalar Chars.
Closing with #1644. This is a JS-only performance request with no wrong output, and the JS backend is the reference runtime: we keep it simple rather than add special cases for speed. Performance work goes to the C runtime.
Activity
Lorenzobattistela commentedon Oct 19, 2026
Closing with #1644. This is a JS-only performance request with no wrong output, and the JS backend is the reference runtime: we keep it simple rather than add special cases for speed. Performance work goes to the C runtime.