-
Notifications
You must be signed in to change notification settings - Fork 291
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
Optimize instruction dispatch #314
Comments
This architecture could be used to speed up instruction dispatch in |
This article well describes different instruction dispatch techniques and their expected performance: |
Research into different instruction dispatch techniques implementable in Rust: |
PR merged to refactor the instruction dispatch for great wins: #376 |
Closed since all TODO items have been answered or resolved. |
The majority of the overhead of interpreters and in particular
wasmi
interpreter is the overhead of the instruction dispatch.Therefore there are 3 main ways to improve efficiency of efficient interpreters:
match
statement for the dispatch routine is less efficient than having a branch per instruction (match arm) since the branch predictor can include the position of the branch into account for its prediction. Some benchmark indicate 50%-100% performance gains.Work Items
Fuse common instruction sequences into super instructions forwasmi
bytecode during Wasm module compilation.switch
based dispatch into one where branch predictors will benefit more at the cost of increased binary size. LLVM usually opts out of this to our despair. It might be possible to find ways to make LLVM optimize into that form from within Rust.LLVM already supports guaranteed tail calls. As soon as Rust provides them too we should definitely experiment with dispatch based on tail calls similar to the Wasm3 interpreter.The text was updated successfully, but these errors were encountered: