-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
perf: avoid parseRequest #15617
perf: avoid parseRequest #15617
Conversation
Run & review this pull request in StackBlitz Codeflow. |
/ecosystem-ci run |
📝 Ran ecosystem CI on
|
@@ -28,6 +28,10 @@ interface WorkerCache { | |||
|
|||
export type WorkerType = 'classic' | 'module' | 'ignore' | |||
|
|||
export const workerOrSharedWorkerRE = /(?:\?|&)(worker|sharedworker)(?:&|$)/ | |||
const workerFileRE = /(?:\?|&)worker_file&type=(\w+)(?:&|$)/ |
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.
For reference to others, we already depend on the order of query suffixes in other cases, like in html proxies. See
const htmlProxyRE = |
So this should be ok.
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.
Nice one! 👏🏼
Description
ref #14420 (comment)
Avoid
parseRequest
function and use plain regex instead.Perf link too long that it doesn't work :( Here's another benchmark: https://jsperf.app/nikobo
In case that ever fails again, here's the benchmark code:
Details
The result is that the regex version is roughly 70% faster.
Additional context
I made individual commits removing the usage of
parseRequest
(note: I messed up the name in the 3rd commit)What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).