Skip to content

Commit

Permalink
benchmark: add v8 serialize benchmark
Browse files Browse the repository at this point in the history
PR-URL: #45476
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
anonrig authored and ruyadorno committed Nov 21, 2022
1 parent f3f1aed commit f08f6a6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions benchmark/v8/serialize.js
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit f08f6a6

Please sign in to comment.