Skip to content

Commit 34f3021

Browse files
XadillaXtargos
authored andcommittedOct 4, 2021
benchmark: add util.toUSVString()'s benchmark
PR-URL: #40203 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Zijian Liu <[email protected]>
1 parent 685c7d4 commit 34f3021

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
 

‎benchmark/util/to-usv-string.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
const BASE = 'string\ud801';
6+
7+
const bench = common.createBenchmark(main, {
8+
n: [1e5],
9+
size: [10, 100, 500],
10+
});
11+
12+
function main({ n, size }) {
13+
const { toUSVString } = require('util');
14+
const str = BASE.repeat(size);
15+
16+
bench.start();
17+
for (let i = 0; i < n; i++) {
18+
toUSVString(str);
19+
}
20+
bench.end(n);
21+
}

0 commit comments

Comments
 (0)
Please sign in to comment.