Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Add benchmark and speedup #37

Merged
merged 18 commits into from
Feb 1, 2024
Merged

perf: Add benchmark and speedup #37

merged 18 commits into from
Feb 1, 2024

Conversation

danvk
Copy link
Owner

@danvk danvk commented Feb 1, 2024

Fixes #36 at least to some extent!

Throwing a non-Error subclass makes the Fibonacci benchmark ~6x faster:

-Time elapsed (ms): 60459
+Time elapsed (ms): 10152

The difference for the 40th Fibonacci number is even more dramatic, ~2000s → 200s. Still slower than jlox's 27 seconds, but at least within an order of magnitude.

Thanks to https://github.com/davidhfriedman/jslox for the inspiration.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

PR Compliance Checks Passed!

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (452b67f) 97.35% compared to head (1dbec1a) 97.35%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #37   +/-   ##
=======================================
  Coverage   97.35%   97.35%           
=======================================
  Files          17       17           
  Lines        1925     1927    +2     
  Branches      317      317           
=======================================
+ Hits         1874     1876    +2     
  Misses         50       50           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danvk danvk changed the title Add benchmark and speedup perf: Add benchmark and speedup Feb 1, 2024
@danvk danvk merged commit a9b73bd into main Feb 1, 2024
12 checks passed
@danvk danvk deleted the bench branch February 1, 2024 19:54
danvk added a commit that referenced this pull request Feb 18, 2024
Another performance test that's not so stack intensive as Fibonacci
(#37).

Counting the primes less than 10,000:

- gravlax: 36.7s
- jlox: 11s
- clox: 3.6s
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.

🐛 Bug: gravlax is very slow
1 participant