Optimize clone
npuichigo opened this issue · comments
I'm wondering why there're many clones although we already have moved self
and other parameters.
Lines 258 to 261 in a5d292a
Please help me to check if I'm right?
You are right there can be far less. It has to do with the ExpressionStorage trait, which only implements IntoIterator which consumes the object. Instead we should implement IntoIterator on &S so that it yields &Term such that cloning isn't needed
Yes. But since we are already consuming the object here, maybe just removing the clone
and let into_iter
consume self
is enough?
I think it is used more than once there
At least removing clone
in L258 compiles and passes the unit test.
I removed most of the clones by adding an .iter_ref() function to expressionstorage, which creates a borrowed iterator.
I'll go ahead and close this, there's not many clones left in symbolic.