blob: e2bae6d68b40f040552ed3ed6ed02331be7ecb07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { Bench } from "tinybench";
import { parse } from "../src/index.js";
import { readFile } from "fs/promises";
const exampleSource = await readFile("test/example.wmap", "utf-8");
const hugeSource = await readFile("test/huge.wmap", "utf-8");
const bench = new Bench({ name: "Parsing Benchmark", time: 1000 });
bench.add("Example map", () => {
parse(exampleSource);
})
.add("Huge map", () => {
parse(hugeSource);
});
await bench.run();
console.log(bench.name);
console.table(bench.table());
|