mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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:
1 parent
682a730131
commit
a1421623ac
1 file changed
+17
@@ -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);
|
||||
}
|
||||
Reference in new issue
Block a user