abrown opened PR #2888 from inst-format-4
to main
:
This is a follow-up to #2819 to add a benchmark comparing the different encoding approaches (builder vs function) used to encode EVEX instructions. The measurements I observed indicate that the builder pattern is faster, as noted in #2819. The more interesting improvement of this PR is to show how to measure parts of the
cranelift-codegen
crate. To do so withcriterion
, I had to make some of the x64 module public:
- the first commit moves the
encoding
module out ofx64::inst
so thatx64::inst
does not have to become public- the second makes the
x64
module itself public- the third adds the benchmark.
abrown requested cfallin for a review on PR #2888.
abrown submitted PR Review.
abrown created PR Review Comment:
I think this entire benchmark should be feature-gated (i.e.,
#[cfg(feature = "x86")]
) but I don't know the best way to do this?
abrown updated PR #2888 from inst-format-4
to main
.
cfallin submitted PR review.
cfallin created PR review comment:
You could put the whole implementation inside an inner
mod { ... }
with the #[cfg(...)], export one main function, and have an alternate (empty) main function with
[cfg(not(feature = "x86"))]` probably?
cfallin submitted PR review.
abrown updated PR #2888 from inst-format-4
to main
.
abrown submitted PR review.
abrown created PR review comment:
Ok, I finally figured out how to do this. My latest update uses the inner module approach feature-gated on
x86
and prints a "can't run this benchmark" message if the feature is not present.
cfallin submitted PR review.
abrown merged PR #2888.
Last updated: Nov 22 2024 at 16:03 UTC