From 313e3e8a07b8dae085733ef47fe558b41bee9b79 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 15 Nov 2022 11:54:18 -0500 Subject: [PATCH] benchmark: add v8 serialize benchmark --- benchmark/v8/serialize.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 benchmark/v8/serialize.js diff --git a/benchmark/v8/serialize.js b/benchmark/v8/serialize.js new file mode 100644 index 00000000000000..331c576a1b490b --- /dev/null +++ b/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); +}