Open prozacchiwawa opened 5 months ago
Totals | |
---|---|
Change from base Build 8835105043: | 0.0% |
Covered Lines: | 5789 |
Relevant Lines: | 6162 |
thanks @Rigidity for the typedef suggestion and catching the ungated declaration.
I think performance should still be a consideration, since features are additive - if you depend on clvm_tools_rs
and clvmr
in your project for instance, and clvm_tools_rs
enables the feature, its performance effects will be seen on your usage of clvmr
even if you don't specify the feature yourself. So we ideally wouldn't want it to be considerably slower, but I'm guessing the compiler can optimize this to around the same as before.
'This PR has been flagged as stale due to no activity for over 60 days. It will not be automatically closed, but it has been given a stale-pr label and should be manually reviewed.'
This makes PreEval a trait which is passed down the stack as a mutable reference. It contains both pre_eval and post_eval methods and calls post_eval when requested based on the result of pre_eval as before.
Because the callback's lifetime is now easily determined to be the lifetime of the run_program call and the other object that could be of use, the allocator is also passed by a mutable reference, the caller has maximal freedom in how their implementation of PreEval works without having to use the Rc<RefCell<...>> pattern and cunning use of move closures to create the callbacks and avoids construction of a Box on each callback for the second closure.
Since this changes the form of the run_program interface, commentary on that is welcome. This is a response to the arch meeting discussion rather than something I'm actively requesting, but I do think this is better overall.