Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions benchmark/json/json-parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';
const { readFile } = require('node:fs/promises');
const common = require('../common.js');
const { parse } = require('node:json');
const path = require('node:path');

const configs = {
n: [1024],
};

const bench = common.createBenchmark(main, configs);

async function main(conf) {
bench.start();

const json = await readFile(path.join(__dirname, 'twitter.json'), 'utf-8');

for (let i = 0; i < conf.n; i++) {
parse(json);
}

bench.end(conf.n);
}
22 changes: 22 additions & 0 deletions benchmark/json/json-v8-parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';
const { readFile } = require('node:fs/promises');
const common = require('../common.js');
const path = require('node:path');

const configs = {
n: [1024],
};

const bench = common.createBenchmark(main, configs);

async function main(conf) {
bench.start();

const json = await readFile(path.join(__dirname, 'twitter.json'), 'utf-8');

for (let i = 0; i < conf.n; i++) {
JSON.parse(json);
}

bench.end(conf.n);
}
Loading