Rc is cheap and kicks in only during count increase and decrease, butRefCell checks can accumulate to quite a bit overhead (2% CPU time). While very useful, as it proves that there's no aliasing when operating on very interconnected mioco structures (and such aliasing is very easy to introduce by accident), this costs is significant in performance cricial component.
I have an idea of building a RefCell-mimicing type, that does the aliasing testing only in debug mode.
In normal code such optimization is not worth it, but mioco codepaths are very few and generic, doing one debug mode test is enough to prove that there's no aliasing anywhere.
Mioco is using
Rc<RefCell<...>>
a lot.Rc
is cheap and kicks in only during count increase and decrease, butRefCell
checks can accumulate to quite a bit overhead (2% CPU time). While very useful, as it proves that there's no aliasing when operating on very interconnected mioco structures (and such aliasing is very easy to introduce by accident), this costs is significant in performance cricial component.I have an idea of building a RefCell-mimicing type, that does the aliasing testing only in debug mode.
In normal code such optimization is not worth it, but mioco codepaths are very few and generic, doing one debug mode test is enough to prove that there's no aliasing anywhere.