-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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 <[email protected]> Reviewed-By: Kyle Farnung <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jon Moss <[email protected]>
- 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