quil-rs icon indicating copy to clipboard operation
quil-rs copied to clipboard

wip: use arena-style cache when simplifying Expressions (DO NOT MERGE)

Open Shadow53 opened this issue 1 year ago • 0 comments

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.

Shadow53 avatar Aug 09 '23 20:08 Shadow53