zBlock-2 / summa-solvency-Turing

Apache License 2.0
0 stars 0 forks source link

Excessive usage of clone() feature throughout repo #6

Closed sachindkagrawal15 closed 1 month ago

sachindkagrawal15 commented 4 months ago

There seems to be excessive use of clone() features throughout the repo and even in loops.

Loops example : zk_prover/src/merkle_sum_tree/utils/build_tree.rs for (index, leaf) in leaves.iter().enumerate() { tree[0][index] = leaf.clone(); }

Are these excessive use of cloning throughout repo the real use cases of needing a copy or a simple work around the borrow-checker? If this is simply to avoid compiler error, this is an anti-pattern by cloning the variable and an alternative should be worked upon. Excessive cloning can have performance impacts. If these all cloning usages are required per use case, then cloning optimisation techniques can be applied.