3 ms·
> Use fewer references and copy data. Or: "Just clone". > This is generally good advice. Usually, extra allocations are fine, and the resulting performance deg
by Boxxed 1y ago
> Use fewer references and copy data. Or: "Just clone".
> This is generally good advice. Usually, extra allocations are fine, and the resulting performance degradation is not an issue. But it is a little strange that it allocations are encouraged in an otherwise performance-forcused language, not because the program logic demands it, but because the borrowchecker does.
I often end up writing code that (seems) to do a million tiny clones. I've always been a little worried about fragmentation and such but it's never been that much of an issue -- I'm sure one day it will be. I've often wanted a dynamically scoped allocator for that reason.