11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common.js'); 31cb0ef41Sopenharmony_ciconst querystring = require('querystring'); 41cb0ef41Sopenharmony_ciconst inputs = common.searchParams; 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst bench = common.createBenchmark(main, { 71cb0ef41Sopenharmony_ci type: Object.keys(inputs), 81cb0ef41Sopenharmony_ci n: [1e6], 91cb0ef41Sopenharmony_ci}); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_cifunction main({ type, n }) { 121cb0ef41Sopenharmony_ci const input = inputs[type]; 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ci // Execute the function a "sufficient" number of times before the timed 151cb0ef41Sopenharmony_ci // loop to ensure the function is optimized just once. 161cb0ef41Sopenharmony_ci if (type === 'multicharsep') { 171cb0ef41Sopenharmony_ci for (let i = 0; i < n; i += 1) 181cb0ef41Sopenharmony_ci querystring.parse(input, '&&&&&&&&&&'); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci bench.start(); 211cb0ef41Sopenharmony_ci for (let i = 0; i < n; i += 1) 221cb0ef41Sopenharmony_ci querystring.parse(input, '&&&&&&&&&&'); 231cb0ef41Sopenharmony_ci bench.end(n); 241cb0ef41Sopenharmony_ci } else { 251cb0ef41Sopenharmony_ci for (let i = 0; i < n; i += 1) 261cb0ef41Sopenharmony_ci querystring.parse(input); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci bench.start(); 291cb0ef41Sopenharmony_ci for (let i = 0; i < n; i += 1) 301cb0ef41Sopenharmony_ci querystring.parse(input); 311cb0ef41Sopenharmony_ci bench.end(n); 321cb0ef41Sopenharmony_ci } 331cb0ef41Sopenharmony_ci} 34