3 ms·
"The JavaScript model of "call some callback when the currently-executing function returns" doesn't work," I can't prove it, but at this scale, I am guessing t
by jerf 11y ago
"The JavaScript model of "call some callback when the currently-executing function returns" doesn't work,"
I can't prove it, but at this scale, I am guessing that the cost of constructing call frames to call into the callback will start to matter, too. Switching into an already-existing context is probably significantly cheaper. (Well, it's definitely significantly cheaper to switch into an existing C context than construct a Javascript call, but, that's sort of cheating. Or a low blow. Or something like that.)
- deleted 11y ago[deleted]
- TickleSteve 11y agoNot even remotely... To setup for a call to a C function is a matter of a handfull of instructions. To setup a context switch is hundreds.
- jerf 11y agoIf you're talking about kernel context switches, the JS has them too, and then has more instructions to set up the JS call stack to boot. Setting up a million JS call stacks is not necessarily trivial. A million here, a million there, soon you're talking real wall-clock time.