

Fixing Threads in Ruby 1.8: A 2-10x performance boost - sprsquish
http://timetobleed.com/fixing-threads-in-ruby-18-a-2-10x-performance-boost/

======
scott_s
Does anyone know what Ruby 1.9 does for creating threads? Does it do something
similar to what the author does, or something else entirely?

~~~
ice799
Hi. Author here.

Ruby 1.9 uses libpthread which creates stacks for its threads in a similar way
(mmap and a guard page).

~~~
scott_s
You mean it calls pthread_create for every Ruby thread? That would mean
threads are no longer green threads, since both of the widely used Pthread
libraries on Linux (Linuxthreads on 2.4 versions of the kernel, and NTPL on
2.6) have a 1-to-1 mapping of POSIX threads to kernel threads.

~~~
ice799
correct. but they each take a global interpreter lock ensuring only one is
executing at any given time.

------
grandalf
wow this is a superb post. I wonder why anyone would really want to take the
trouble to move to ruby 1.9 anymore...

I'd be curious to see the rest of the benchmarks.

~~~
jcapote
I'm curious why someone would go through the trouble to _stay_ on 1.8?

~~~
FooBarWidget
Library compatibility. Many libraries are still not compatible with 1.9. It's
good to have interim improvements for 1.8 until the ecosystem has caught up
with 1.9, because 1.8 is what actually powers production systems today.

~~~
rbanffy
"Many libraries are still not compatible with 1.9"

It's not likely they will remain so for very long

~~~
grandalf
I hope you're right. But I'd rather that the move to 1.9 be based on its
merits as enhancements to the language rather than on the lack (in 1.8) of the
sorts of optimizations that were made in the article.

~~~
rbanffy
I would gladly accept a major library breakage for proper multi-processor
support in Python. A better implementation is a significant enhancement.

