From 9ae513a7de1cc83f3dd0dfe00376d8beab1bd735 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Tue, 30 Jan 2018 18:41:25 +0800 Subject: [PATCH] benchmark: shorten config name in http benchmark 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: https://github.com/nodejs/node/pull/18452 Reviewed-By: Luigi Pinca Reviewed-By: Weijia Wang Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- benchmark/http/check_invalid_header_char.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/benchmark/http/check_invalid_header_char.js b/benchmark/http/check_invalid_header_char.js index b9933d690e25cc..399e71b2dfcc88 100644 --- a/benchmark/http/check_invalid_header_char.js +++ b/benchmark/http/check_invalid_header_char.js @@ -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 @@ -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' @@ -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);