Hacker News new | ask | show | jobs
by bullen 1516 days ago
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.

1 comments

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)