Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: