3 ms·
Helpful links, thank you! > The simplest tool is to just grep for various constructs that copy or allocate. Do you happen to have a curated list somewhere?
by pdimitar 6y ago
Helpful links, thank you!
> The simplest tool is to just grep for various constructs that copy or allocate.
Do you happen to have a curated list somewhere?
- SAI_Peregrinus 6y agoFor allocations (more expensive in many cases) the Rust container cheat sheet[1] is helpful. Box, Vec, Rc, Arc, and Mutex are the standard types which allocate. Not sure of a list for things that copy their data. The Clone trait is the obvious one, and it requires calling clone() to make the copy. EG `val.clone()`. So searching for `.clone()` will get you those. But other things like to_string are expensive, and From/Into are sometimes expensive. [1] https://docs.google.com/presentation/d/1q-c7UAyrUlM-eZyTo1pd8SZ0qwA_wYxmPZVOQkoDmH4/edit#slide=id.p https://docs.google.com/presentation/d/1q-c7UAyrUlM-eZyTo1pd...