Hacker News new | ask | show | jobs
by edflsafoiewq 1706 days ago
quickjs has pretty cool case conversion too. It special cases ASCII, then does the rest with a binary search through some kinda run-length encoded table. There's more code but the table itself is only about 2K for both case directions.

https://github.com/bellard/quickjs/blob/b5e62895c619d4ffc75c...

1 comments

The ASCII special case is especially important when you apply casing operations to a run of code points, where you can leverage SIMD or any bitwise trickery to convert a block of ASCII characters and fall back to a slow iteration otherwise.