quil-rs
quil-rs copied to clipboard
wip: use arena-style cache when simplifying Expressions (DO NOT MERGE)
This PR is meant as a reference and not to be merged (yet).
It is based on @genos' simplify-by-hand
branch and attempts to improve performance by using an arena-based cache during Expression
simplification.
Some internal benchmarks seem to show a good improvement (~17%) in runtime when the cache is actually useful, but an overhead of 1-5% when not useful (no repeated expressions). This may be conflated with the item below, which also helps performance -- I did not benchmark them separately.
One thing that may be useful enough to pull into its own PR is the change to not use hashing in the implementation of PartialEq
for Expression
, which also helps speed things up.