Hacker News new | ask | show | jobs
by blibble 1512 days ago
there's still a context switch with NIO, you're just doing it manually
1 comments

The context switches in NIO is between fewer threads, you just need one per core.

Memory contention is also playing into this.

The benchmark they made is asking the question in a way that it leans into the answer they need, just like 99% of all human activity it's biased.

you're missing the point and taking "context switch" literally

with NIO you are still managing the stack, just yourself instead of letting the operating system do it for you

it is still a "context switch", just done in your code instead of the OS

and that's not free (and likely more expensive than saving and restoring a set of registers)