diff options
author | Yagiz Nizipli <yagiz@nizipli.com> | 2022-11-21 13:18:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-21 18:18:44 +0000 |
commit | 09d083fe9b7718fb76facaee4cd26c59efa3f0bb (patch) | |
tree | 17f8a1007cbb99cc818217cf94931ea3ef592d37 /benchmark | |
parent | 59bb1981613332d8e66f4220c30aa5f0c6ab39c7 (diff) | |
download | node-new-09d083fe9b7718fb76facaee4cd26c59efa3f0bb.tar.gz |
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>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/v8/serialize.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/benchmark/v8/serialize.js b/benchmark/v8/serialize.js new file mode 100644 index 0000000000..331c576a1b --- /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); +} |