bluesky-social / atproto

Social networking technology created by Bluesky
Other
6.9k stars 490 forks source link

Add fast path skipping grapheme counting #2817

Closed gaearon closed 1 month ago

gaearon commented 2 months ago

Not a huge deal but since we visit this codepath for every single validated string, seems like we'd want to avoid any unnecessary computation here, especially on low-end devices.

I don't know how encodings and grapheme work very well so this needs a close look.

Commits

Before

This was showing up in a profile for switching tabs with 6x throttling. (Note this is a DEV profile so in PROD its % would be higher compared to other things around it.)

Screenshot 2024-09-14 at 16 23 43

After

It doesn't show up.

Screenshot 2024-09-14 at 16 30 34
gaearon commented 1 month ago

Pushed style tweaks per review. Have not verified that it's equivalent.