File: benchmark.js

package info (click to toggle)
node-strip-json-comments 4.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 896 kB
  • sloc: javascript: 201; makefile: 5
file content (19 lines) | stat: -rw-r--r-- 484 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* globals bench, set */
import fs from 'node:fs';
import stripJsonComments from './index.js';

const json = fs.readFileSync('sample.json', 'utf8');
const bigJson = fs.readFileSync('sample-big.json', 'utf8');

bench('strip JSON comments', () => {
	set('type', 'static');
	stripJsonComments(json);
});

bench('strip JSON comments without whitespace', () => {
	stripJsonComments(json, {whitespace: false});
});

bench('strip Big JSON comments', () => {
	stripJsonComments(bigJson);
});