forked from bluesky-social/indigo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax: ParseDID performance (bluesky-social#853)
we are apparently burning a bunch of CPU on this regex in prod, so let's bypass for the most common case (valid did:plc). Would be nice to have a benchmark demonstrating perf gains (or not). I did some manually testing with the CLI helper and inserted `panic()` statements to confirm that valid DID PLC stays on fast path, and other DIDs don't. Feedback welcome if there is a more idiomatic/performant golang way to do this... this is still doing unicode stuff, I assume, and maybe casting to bytes would be faster? though probably doesn't impact the actual hot path much. `strings.ContainsAny` or `strings.ContainsFunc` could be used here I guess but 🤷
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters