On the effect of branch mispredictions in the Squeak VM

Andreas Raab andreas.raab at gmx.de
Mon Jul 7 10:41:44 UTC 2003


Hi John,

> My numbers using mac vm 3.5.2b1 (500Mhz G3) are:
> 
> 10	0	0
> 100	0	0
> 1000	1	1
> 10000	8	7
> 100000	77	78
> 1000000	797	781
> 10000000	7817	7861

Just curious: Do you "gnuify" the VM before compiling it[*]? The above looks
as if you might still be using the switch-based dispatch (in which case
there should be no difference between the two versions as the branch
prediction will _always_ be wrong no matter how you arrange the bytecodes).
If you don't gnuify it, I'd recommend doing so - like I said it bought me a
factor of two in speed.

[*] The important part of gnuification here is to replace the switch/break
statements with labeled gotos which are supported by GCC but not other
compilers. The gnuify script also allows explicit assignment of registers
for certain variables (like localIP/localSP/currentBytecode) and I am almost
certain that fiddling around with this should be helpful for PPC too.

Cheers,
  - Andreas



More information about the Squeak-dev mailing list