From 68a999ed21907ef8f14c1aa0bf760d3c9b4b4c8c Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Fri, 12 Dec 2025 01:02:45 +0100 Subject: Add parsing --- benchmark/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 benchmark/index.js (limited to 'benchmark') 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()); -- cgit