2017-01-16 15:46:36 +01:00
|
|
|
'use strict';
|
2017-09-14 03:48:53 +02:00
|
|
|
const common = require('../common.js');
|
|
|
|
const querystring = require('querystring');
|
2017-01-16 15:46:36 +01:00
|
|
|
|
2017-09-14 03:48:53 +02:00
|
|
|
const bench = common.createBenchmark(main, {
|
2017-01-16 15:46:36 +01:00
|
|
|
input: [
|
|
|
|
'there is nothing to unescape here',
|
|
|
|
'there%20are%20several%20spaces%20that%20need%20to%20be%20unescaped',
|
|
|
|
'there%2Qare%0-fake%escaped values in%%%%this%9Hstring',
|
2019-02-05 07:06:08 +01:00
|
|
|
'%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F%30%31%32%33%34%35%36%37',
|
2017-01-16 15:46:36 +01:00
|
|
|
],
|
|
|
|
n: [10e6],
|
|
|
|
});
|
|
|
|
|
2017-12-30 03:56:18 +01:00
|
|
|
function main({ input, n }) {
|
2017-01-16 15:46:36 +01:00
|
|
|
bench.start();
|
2019-07-31 15:26:38 +02:00
|
|
|
for (let i = 0; i < n; i += 1)
|
2017-01-16 15:46:36 +01:00
|
|
|
querystring.unescapeBuffer(input);
|
|
|
|
bench.end(n);
|
|
|
|
}
|