mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
benchmark: var to const
PR-URL: https://github.com/nodejs/node/pull/13757 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
'use strict';
|
||||
var common = require('../common.js');
|
||||
var querystring = require('querystring');
|
||||
const common = require('../common.js');
|
||||
const querystring = require('querystring');
|
||||
|
||||
var bench = common.createBenchmark(main, {
|
||||
const bench = common.createBenchmark(main, {
|
||||
type: ['noencode', 'encodemany', 'encodelast'],
|
||||
n: [1e7],
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
var type = conf.type;
|
||||
var n = conf.n | 0;
|
||||
const type = conf.type;
|
||||
const n = conf.n | 0;
|
||||
|
||||
var inputs = {
|
||||
const inputs = {
|
||||
noencode: {
|
||||
foo: 'bar',
|
||||
baz: 'quux',
|
||||
@@ -28,11 +28,11 @@ function main(conf) {
|
||||
xyzzy: 'thu\u00AC'
|
||||
}
|
||||
};
|
||||
var input = inputs[type];
|
||||
const input = inputs[type];
|
||||
|
||||
// Force-optimize querystring.stringify() so that the benchmark doesn't get
|
||||
// disrupted by the optimizer kicking in halfway through.
|
||||
for (var name in inputs)
|
||||
for (const name in inputs)
|
||||
querystring.stringify(inputs[name]);
|
||||
|
||||
bench.start();
|
||||
|
||||
Reference in New Issue
Block a user