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

🐛 Bug: gravlax is very slow #36

Closed
3 tasks done
danvk opened this issue Feb 1, 2024 · 0 comments · Fixed by #37
Closed
3 tasks done

🐛 Bug: gravlax is very slow #36

danvk opened this issue Feb 1, 2024 · 0 comments · Fixed by #37
Labels
type: bug Something isn't working :( 🐛

Comments

@danvk
Copy link
Owner

danvk commented Feb 1, 2024

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

Tree-walk interpreters are expected to be slow.

Actual

Mine is quite slow! jlox takes ~27s to evaluate fib(40) on my machine whereas gravlax takes ~34 minutes.

Most JS implementations are pretty slow. The only one I've found that's meaningfully faster is https://github.com/davidhfriedman/jslox

Additional Info

No response

@danvk danvk added the type: bug Something isn't working :( 🐛 label Feb 1, 2024
@danvk danvk closed this as completed in #37 Feb 1, 2024
danvk added a commit that referenced this issue 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working :( 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant