|
|
|
|
|
by stouset
457 days ago
|
|
> What? Golang append()s also periodically grow the slice. If you already know the size of the result (there are no filtering operations), the functional approach can trivially allocate the resulting array to already have the correct capacity. This happens with zero user intervention. IIRC the Rust optimizer basically emits more or less optimal machine code (including SIMD) for most forms of iteration. |
|
If overallocating is indeed OK for your usecase, then you can do so yourself