benchmark: fix punycode test for --without-intl
PR-URL: https://github.com/nodejs/node/pull/16251 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
2146c88bc7
commit
f8063d51d7
@ -1,11 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const icu = process.binding('icu');
|
let icu;
|
||||||
|
try {
|
||||||
|
icu = process.binding('icu');
|
||||||
|
} catch (err) {}
|
||||||
const punycode = require('punycode');
|
const punycode = require('punycode');
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
method: ['punycode', 'icu'],
|
method: ['punycode'].concat(icu !== undefined ? ['icu'] : []),
|
||||||
n: [1024],
|
n: [1024],
|
||||||
val: [
|
val: [
|
||||||
'افغانستا.icom.museum',
|
'افغانستا.icom.museum',
|
||||||
@ -69,8 +72,11 @@ function main(conf) {
|
|||||||
runPunycode(n, val);
|
runPunycode(n, val);
|
||||||
break;
|
break;
|
||||||
case 'icu':
|
case 'icu':
|
||||||
runICU(n, val);
|
if (icu !== undefined) {
|
||||||
break;
|
runICU(n, val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// fallthrough
|
||||||
default:
|
default:
|
||||||
throw new Error('Unexpected method');
|
throw new Error('Unexpected method');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user