Skip to content

Commit f08f6a6

Browse files
anonrigruyadorno
authored andcommitted
benchmark: add v8 serialize benchmark
PR-URL: #45476 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent f3f1aed commit f08f6a6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

benchmark/v8/serialize.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
const common = require('../common.js');
4+
const v8 = require('v8');
5+
6+
const bench = common.createBenchmark(main, {
7+
len: [256, 1024 * 16, 1024 * 512],
8+
n: [1e6]
9+
});
10+
11+
function main({ n, len }) {
12+
const typedArray = new BigUint64Array(len);
13+
bench.start();
14+
for (let i = 0; i < n; i++)
15+
v8.serialize({ a: 1, b: typedArray });
16+
bench.end(n);
17+
}

0 commit comments

Comments
 (0)