-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: parseIdentifier fast path for requests without \0 #444
feat: parseIdentifier fast path for requests without \0 #444
Conversation
|
||
/** | ||
* @param {string} identifier identifier | ||
* @returns {[string, string, string]|null} parsed identifier | ||
*/ | ||
function parseIdentifier(identifier) { | ||
if (!identifier) { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly this should be ["","",""]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that in practice it doesn't matter to callers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #444 +/- ##
==========================================
- Coverage 92.50% 92.41% -0.10%
==========================================
Files 44 44
Lines 2135 2149 +14
Branches 657 662 +5
==========================================
+ Hits 1975 1986 +11
- Misses 131 132 +1
- Partials 29 31 +2 ☔ View full report in Codecov by Sentry. |
Thank you |
Adds a fast path to
parseIdentifier
that avoids the overhead of regex processing when the input does not contain a null character. Improves performance ofparseIdentifier
by ~75% for typical usage on NodeJS 18.19.1.Before:
After:
Adds additional unit tests to
parseIdentifier
for NULL-escaped strings.