Bug #2553: Fix pthreads slowness by eliminating unnecessary sigprocmask calls
http://redmine.ruby-lang.org/issues/show/2553

Author: Dan Peterson
Status: Open, Priority: Normal
ruby -v: ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux]

This is a bug report for what's described here:

http://timetobleed.com/fix-a-bug-in-rubys-configurein-and-get-a-30-performance-boost/

Matz says here that this should already be fixed in 1.8.7:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/23583

But it does not appear to be. Example with 1.8.7-p248:

# apply patch from above link
% make distclean
% ./configure --enable-pthread
% make
% time ./ruby -e '1_000_000.times { x = 2 ** 256 }'
./ruby -e '1_000_000.times { x = 2 ** 256 }'  1.45s user 0.34s system 99% cpu 1.809 total
% strace ./ruby -e '1_000.times { x = 2 ** 256 }' 2>&1 | grep -c sigproc 
1009
% make distclean
% ./configure --disable-ucontext --enable-pthread
% make
% time ./ruby -e '1_000_000.times { x = 2 ** 256 }'
./ruby -e '1_000_000.times { x = 2 ** 256 }'  1.16s user 0.00s system 99% cpu 1.171 total
% strace ./ruby -e '1_000.times { x = 2 ** 256 }' 2>&1 | grep -c sigproc 
3

% ./ruby -v
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux]


----------------------------------------
http://redmine.ruby-lang.org