diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-12 01:02:45 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-12 12:30:14 +0100 |
| commit | 68a999ed21907ef8f14c1aa0bf760d3c9b4b4c8c (patch) | |
| tree | a9cb57d999005c2b0fc7c94f45b89aacea23a95b /benchmark | |
Add parsing
Diffstat (limited to 'benchmark')
| -rw-r--r-- | benchmark/index.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/benchmark/index.js b/benchmark/index.js new file mode 100644 index 0000000..e2bae6d --- /dev/null +++ b/benchmark/index.js @@ -0,0 +1,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()); |