On Tue, Jan 22, 2008 at 07:46:37AM +0900, Charles Oliver Nutter wrote:
> Paul Brannan wrote:
> >I also have an example where I'm not seeing a slowdown.  The most 
> >striking difference seems to be that my desktop (which exhibits the 
> >slowdown) is a dual Xeon running an SMP kernel, whereas my laptop (where 
> >YARV runs as fast as 1.8) is a single-CPU Pentium 4.
> >
> >Are there any known incompatibilities between YARV and SMP?
> 
> Shot in the dark: more GIL lock contention since threads can actually 
> try to run in parallel?

Seems to have been fixed in revision 15040:

Mon Jan 14 18:10:59 2008  Koichi Sasada  <ko1 / atdot.net>

  * vm.h: remove dangerous assembler sentence.

[pbrannan@zem ruby]$ svn diff -r 15039:15040 vm.h
Index: vm.h
===================================================================
--- vm.h        (revision 15039)
+++ vm.h        (revision 15040)
@@ -143,7 +143,6 @@
 
 /* for GCC 3.4.x */
 #define TC_DISPATCH(insn) \
-  DISPATCH_ARCH_DEPEND_WAY(GET_CURRENT_INSN()); \
   INSN_DISPATCH_SIG(insn); \
   goto *GET_CURRENT_INSN(); \
   ;

I'm not sure what this does, but it seems to be the culprit.

So whereas before the bottleneck was visible at 1_000_000 iterations:

1000000 3.041384 3.806937 
2000000 6.065291 9.195241 

it is now not apparent at even 20_000_000 iterations:

20000000 60.628283 59.883455 

though it's possible that there's still a bottleneck that's not visible
until the program runs much longer.

(incidentally, all the dual-processor machines I tested on are running
gcc 3.4, so I guess it's not an SMP issue after all)

Paul