-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
refactor(lib/request): remove unused params #327
Conversation
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.
historically, these impacted perf as it removed a C++ call in V8.
Thanks for the insight @mcollina, do you know if this is still a thing with Node >= 20? |
is there more information regarding this "hack"? |
It shouldn't be, but it should be measured. |
Threw together a quick benchmark: 'use strict'
const Benchmark = require('benchmark')
const suite = new Benchmark.Suite()
function noParams () {
return 'hello'
}
function unusedParams (_unused) {
return 'hello'
}
suite.add('Unused Params Function', function () {
unusedParams()
})
.add('No Params Function', function () {
noParams()
})
.on('cycle', function (event) {
console.log(String(event.target))
})
.on('complete', function () {
console.log('Fastest is ' + this.filter('fastest').map('name'))
})
.run() Output (running on Intel i7-13650HX @4.9Ghz) with Node 20.18.1:
|
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.
lgtm
Not used at all within their respective functions.
Checklist
npm run test
andnpm run benchmark
and the Code of conduct