Skip to content
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

Use loop for acceptParams #54

Merged
merged 1 commit into from
Nov 16, 2024
Merged

Use loop for acceptParams #54

merged 1 commit into from
Nov 16, 2024

Conversation

nigrosimone
Copy link
Contributor

@nigrosimone nigrosimone commented Nov 16, 2024

from expressjs/express#6066

Using a loop here would improve performance for parsing over splitting into an array and iterating over it, then splitting some more. If we prefer the overall split on ; for readability though, we can still avoid the second split by using indexOf instead. There's also some slices and trim that could be avoided for extra performance but it seemed a little overkill for this function.

benchmark here https://jsbm.dev/ZbkL2XxwbkIOI

Master Ops/s: 104.800
PR     Ops/s: 251.541

Copy link

pkg-pr-new bot commented Nov 16, 2024

Open in Stackblitz

npm i https://pkg.pr.new/dimdenGD/ultimate-express@54

commit: b43befa

@dimdenGD dimdenGD merged commit 08696d3 into dimdenGD:main Nov 16, 2024
6 checks passed
@nigrosimone nigrosimone deleted the patch-1 branch November 16, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants