benchmark: add v8 serialize benchmark

PR-URL: https://github.com/nodejs/node/pull/45476
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Yagiz Nizipli authored and Danielle Adams committed 2023-01-03 08:38:58 -05:00
1 parent 682a730131
commit a1421623ac
1 file changed
+17
+17
View File
@@ -0,0 +1,17 @@
'use strict';
const common = require('../common.js');
const v8 = require('v8');
const bench = common.createBenchmark(main, {
len: [256, 1024 * 16, 1024 * 512],
n: [1e6]
});
function main({ n, len }) {
const typedArray = new BigUint64Array(len);
bench.start();
for (let i = 0; i < n; i++)
v8.serialize({ a: 1, b: typedArray });
bench.end(n);
}