3 ms·
Closures are just as expensive as normal control flow, if they're not passed as a trait object (which is unusual). To expand: No closures require heap allocati
by heinrich5991 11y ago
Closures are just as expensive as normal control flow, if they're not passed as a trait object (which is unusual).
To expand: No closures require heap allocation. If you pass the closure as trait object, calling it will require a virtual function call, which is more expensive than a normal one.