alexcrichton opened PR #9122 from alexcrichton:better-enum-codegen
to bytecodealliance:main
:
This commit improves the compile time of generating bindings for enums with many cases in them (e.g. 1000+). This is done by optimizing for enums specifically rather than handling them generically like other variants which can reduce the amount of code going into rustc to O(1) instead of O(N) with the number of cases. This in turn can greatly reduce compile time.
The tradeoff made in this commit is that enums are now required to have
#[repr(...)]
annotations along with no Rust-level discriminants specified. This enables the use of atransmute
to lift a discriminant into Rust with a simple bounds check. Previously this was one largematch
statement.Closes #9081
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested pchickey for a review on PR #9122.
alexcrichton requested wasmtime-core-reviewers for a review on PR #9122.
alexcrichton updated PR #9122.
pchickey submitted PR review.
alexcrichton updated PR #9122.
alexcrichton has enabled auto merge for PR #9122.
alexcrichton updated PR #9122.
alexcrichton has enabled auto merge for PR #9122.
alexcrichton merged PR #9122.
Last updated: Dec 23 2024 at 12:05 UTC