Skip to content

Conversation

@cawalch
Copy link
Collaborator

@cawalch cawalch commented Dec 1, 2024

  • Replaces deprecated benchmark with 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)
npm run perf

> @jmespath-community/[email protected] 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  │
└─────────┴─────────────────────────────────┴──────────────┴────────────────────┴──────────┴──────────┘

- 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/[email protected] 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 -->
Copy link
Contributor

@springcomp springcomp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks awesome.
Thanks for the contribution.

@springcomp springcomp merged commit 02604a6 into jmespath-community:main Dec 2, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants