Skip to content

Commit

Permalink
benchmark: shorten config name in http benchmark
Browse files Browse the repository at this point in the history
Shorten the config name in check_invalid_header_char so it would
not result in long lines that make the benchmark result hard to read.

PR-URL: #18452
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
joyeecheung authored and MylesBorins committed Feb 21, 2018
1 parent 8c9b41a commit 9ae513a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions benchmark/http/check_invalid_header_char.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
const common = require('../common.js');
const _checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;

// Put it here so the benchmark result lines will not be super long.
const LONG_AND_INVALID = 'Here is a value that is really a folded header ' +
'value\r\n this should be supported, but it is not currently';

const bench = common.createBenchmark(main, {
key: [
// Valid
Expand All @@ -21,8 +25,7 @@ const bench = common.createBenchmark(main, {
'en-US',

// Invalid
'Here is a value that is really a folded header value\r\n this should be \
supported, but it is not currently',
'LONG_AND_INVALID',
'中文呢', // unicode
'foo\nbar',
'\x7F'
Expand All @@ -31,6 +34,9 @@ const bench = common.createBenchmark(main, {
});

function main({ n, key }) {
if (key === 'LONG_AND_INVALID') {
key = LONG_AND_INVALID;
}
bench.start();
for (var i = 0; i < n; i++) {
_checkInvalidHeaderChar(key);
Expand Down

0 comments on commit 9ae513a

Please sign in to comment.