You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clone a template BodyTransformer to avoid re-initialization (#4259)
Currently, we have to create a new `BodyTransformer` for each harness
individually. However, this takes a lot of time (as we have to
constantly re-validate all our Kani functions and reinitialize
everything based on the `QueryDb`) and the transformer's options are all
shared between harnesses of the same codegen unit anyway.
This PR makes the `BodyTransformer` struct `Clone`-able, allowing us to
initialize a single 'template' transformer for each codegen unit and
then cheaply clone the template for each harness within the unit. Based
on testing, the clone takes just ~3µs when using the default # of
transformation passes, which is much faster than initialization.
### Results
This change made a noticeable **4.8% reduction in the end to end compile
time of the standard library** (at std commit
[177d0fd](model-checking/verify-rust-std@177d0fd)
& assuming #4257 is merged into Kani).
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
0 commit comments