Hacker News new | past | comments | ask | show | jobs | submit login

> I think that has to do with thread switching overhead. Threads have a relatively high switching overhead, so I don't think it's advisable to run more than 100 threads - in Ruby at least.

If you run many threads the bytecode VM of all threads are contending for the GIL in order to advance the program.




While true, the same would apply to code using Async blocks. Async does not attempt (or intend) to enable parallel execution of VM byte code.

If the parent commenter saw a speed up in their tests, it’s reasonable to assume that is because of the difference in overhead of switching threads vs fibers.


Fibers don't contend on the GIL.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: