3 ms·
The (potential) overhead lies with 'ctx' of course. The lambda syntax makes it all too easy to forget about it.
by Koshkin 5y ago
The (potential) overhead lies with 'ctx' of course. The lambda syntax makes it all too easy to forget about it.
- ncmncm 5y agoA 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.
- Koshkin 5y agoYou have to look beyond the pointer, of course. (An object and a pointer to it, ‘this’, are two different things.)