Commit 02604a6
authored
perf(scripts): improve performance benchmarking accuracy (#36)
- Replaces deprecated [benchmark](https://github.com/bestiejs/benchmark.js) with [tinybench](https://github.com/tinylibs/tinybench)
- Updates `scripts/perf.js` to use tinybench
- Enforces warm-up and garbage collection (gc between runs may not be needed, but it should minimize interference)
```shell
npm run perf
> @jmespath-community/jmespath@1.1.4 perf
> node --expose-gc scripts/perf.js
┌─────────┬─────────────────────────────────┬──────────────┬────────────────────┬──────────┬──────────┐
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │
├─────────┼─────────────────────────────────┼──────────────┼────────────────────┼──────────┼──────────┤
│ 0 │ 'Parser#single_expr' │ '14,010,279' │ 71.37616207528444 │ '±0.74%' │ 14010280 │
│ 1 │ 'Parser#single_subexpr' │ '7,064,237' │ 141.55808538731404 │ '±0.06%' │ 7064238 │
│ 2 │ 'Parser#deeply_nested_50' │ '340,225' │ 2939.2295062691283 │ '±0.57%' │ 340226 │
│ 3 │ 'Parser#deeply_nested_50_index' │ '196,826' │ 5080.625386760879 │ '±0.52%' │ 196827 │
│ 4 │ 'Parser#basic_list_projection' │ '3,958,033' │ 252.6507331664748 │ '±0.61%' │ 3958034 │
└─────────┴─────────────────────────────────┴──────────────┴────────────────────┴──────────┴──────────┘
```
<!-- ps-id: 5d145054-8cd2-42df-abf6-bd252e64d9ee -->1 parent 716c0f0 commit 02604a6
3 files changed
+48
-50
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
| |||
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
| 1 | + | |
| 2 | + | |
4 | 3 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 4 | + | |
14 | 5 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments