-
-
Notifications
You must be signed in to change notification settings - Fork 594
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(router): use .concat
instead of spread syntax
#3584
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3584 +/- ##
=======================================
Coverage 94.72% 94.72%
=======================================
Files 158 158
Lines 9553 9555 +2
Branches 2815 2815
=======================================
+ Hits 9049 9051 +2
Misses 504 504 ☔ View full report in Codecov by Sentry. |
@EdamAme-x Thank you! |
Hey @EdamAme-x I've benchmarked the "spread syntax" vs The script: import { bench, group, run } from 'mitata'
const ARRAY_SIZE = 10000
const array1: number[] = []
const array2: number[] = []
for (let i = 0; i < ARRAY_SIZE; ++i) {
array1.push(i)
array2.push(i)
}
bench('noop', async () => {})
group(() => {
bench('spread syntax', async () => {
;[...array1, ...array2]
})
bench('concat', async () => {
array1.concat(array2)
})
})
run() Node.jsARRAY_SIZE =
ARRAY_SIZE =
BunARRAY_SIZE =
ARRAY_SIZE =
As you said, |
If you're interested in performance improvement, it's great to measure performance with benchmarks like the script above using |
* perf(reg-exp-router): use `.concat` instead of spread syntax * chore: format
The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the code