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

The (potential) overhead lies with 'ctx' of course. The lambda syntax makes it all too easy to forget about it.


A pointer argument passed in a register is not what we mean when we say "overhead".

Without the lambda, you would instead need to pass the pointer manually, for identically the same cost. But then the compiler would not understand as well what you were doing, and would be unable to optimize it as well. Here, the lambda gives you negative overhead, vs. what you would have written.


You have to look beyond the pointer, of course. (An object and a pointer to it, ‘this’, are two different things.)




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

Search: