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: nodejs#18452
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
joyeecheung authored and BridgeAR committed Feb 1, 2018
1 parent ef28619 commit d3841ec
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 d3841ec

Please sign in to comment.