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 danielleadams committed Jan 3, 2023
1 parent 682a730 commit a142162
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions benchmark/v8/serialize.js
@@ -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 a142162

Please sign in to comment.