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

Optimise execution speed #114

Closed
malcolmstill opened this issue Sep 19, 2021 · 1 comment
Closed

Optimise execution speed #114

malcolmstill opened this issue Sep 19, 2021 · 1 comment

Comments

@malcolmstill
Copy link
Owner

malcolmstill commented Sep 19, 2021

Goal

  • Speed up the interpreter. fib(39) takes around 26 seconds on my machine. This is in comparison to, say, lua on the same machine taking ~6 seconds.

Details

  • The interpreter loop is currently a large switch statement. One problem is this switch statement ends up with a single jmp instruction which won't be great for the branch predictor
  • Andrew is proposing adding support for labeled continue syntax introduce labeled continue syntax inside a switch expression ziglang/zig#8220, that would generate better machine code including per-instruction jmps
  • In the same issue haberman suggests using a tail-call interpreter which I'm experimenting with in Tail call interpreter dispatch + unified stack #118 (which also unifies the stack...I have another branch that doesn't unify the branch and I'd like to complete both so I can compare them against one another). With the tail call interpreter I'm also experimenting with which parameters to include in the call as we'll get speed up if certain parameters can just remain in registers / avoid register spilling

References

@malcolmstill
Copy link
Owner Author

This is closed (at least initially) by #120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant