M. Edward (Ed) Borasky wrote:
> On Sat, 2008-08-16 at 03:39 +0900, Shot (Piotr Szotkowski) wrote:
>   
>> kevin nolan:
>>
>>     
>>> control: ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux]
>>> (apt-get install ruby)
>>> test:    ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux]
>>> (source compiled with '-O3 -mtune=K8 -march=K8')
>>>       
>> Are you sure the differences are not because of the --with-phtreads
>> flag in Ubuntu”Ēs build? In my case, the difference between Ubuntu”Ēs
>> Ruby and `configure; make; make install` 1.8.6.p111 was about 40%
>> (without touching -O, -mtune and -march).
>>     
>
> Last time I looked, the difference between no optimization whatsoever
> and "-O3 -march=<your chip here>" was about 30 percent. But yes,
> pthreads makes a big difference.

 I've seen huge performance enhancements by not using 
"--enable-pthreads" too.  I initially began to use it after the Ruby 
build admonished me for trying link to the Tk library(which on Solaris 
is built with threading support) without using --enable-pthreads for 
Ruby.  But it turned out to be a bad idea for performance since it makes 
the interpretor invoke a *lot* of getcontext calls that pull down the 
performance by about 50% in cases. 

 I'm not sure why the --enable-pthreads uses the *context calls based 
implementation.  The ruby build messages talk about frequent crashes if 
a pthreads based tcl/tk is linked into a non-pthreaded Ruby.  I though 
that perhaps, having extensions that invoked threads would change the 
context from beneath the Ruby interpretor and leave it in an 
inconsistent state if Ruby didn't store it away first.  So I built an 
extension that created threads and did some trivial computations(I did 
check to make sure that these weren't optimized away by the compiler).   
But that didn't cause ruby 1.8.6 to crash(I haven't tried on 1.9).
 
 What advantages are obtained by using --enable-pthreads in Ruby 1.8?  
I'm also curious if someone has gotten Ruby(built without 
--enable-pthreads) to work successfully(without crashes) with tck/tk 
libraries with threading support built in.

thanks,
 -ps