From: Sam Roberts Date: 2008-07-03T14:18:01+09:00 Subject: Re: Threads and Ruby On Tue, Jul 1, 2008 at 1:31 PM, Charles Oliver Nutter wrote: > Of course that's mostly a factor of Ruby's rather simplistic thread > scheduling, which has a 10ms timeslice and a fairly basic selection > algorithm. Obviously OS scheduling will be better/more advanced, but that > applies equally well to native threads (like in JRuby). Reminds me of the last time I looked at ruby's thread scheduling, every wakeup from select() caused a traversal of the entire list of threads to see if any were blocked on #sleep(). This has horrid performance characteristics for large numbers of threads doing periodic actions. Rewriting code to be single-threaded, and keeping a priority queue of waiting actions solved my apps performance problem, but also made the point that the OS works very hard to have good scheduling behaviour for threads under wide usage patterns, whereas ruby's scheduler just gets the job done. Cheers, Sam