Hacker News new | ask | show | jobs
by eulerphi 4647 days ago
Callbacks cause no resource retention other than the closure whereas context switching incurs a much greater hit.
3 comments

Callbacks cause no resource retention

They do cause resource exhaustion in the developer who has to deal with the cascading callback spaghettis.

Depends what you switch to. Coroutine's just need a C stack for example.
Cooperative context switching within a process is just a register swap. It's about the same cost as a function call.