-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Long ago, V8 was much faster switching on string lengths than values. That is no longer the case, so we can simplify a couple of methods. PR-URL: #18351 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Kyle Farnung <kfarnung@microsoft.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
- Loading branch information
1 parent
b5267a6
commit d764039
Showing
2 changed files
with
46 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
const common = require('../common.js'); | ||
const { OutgoingMessage } = require('_http_outgoing'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
value: [ | ||
'X-Powered-By', | ||
'Vary', | ||
'Set-Cookie', | ||
'Content-Type', | ||
'Content-Length', | ||
'Connection', | ||
'Transfer-Encoding' | ||
], | ||
n: [1e6], | ||
}); | ||
|
||
function main(conf) { | ||
const n = +conf.n; | ||
const value = conf.value; | ||
|
||
const og = new OutgoingMessage(); | ||
|
||
bench.start(); | ||
for (var i = 0; i < n; i++) { | ||
og.setHeader(value, ''); | ||
} | ||
bench.end(n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters