Re: Avoiding Branch Misprediction in Virtual Machine (VM) Portably

moron451-compiler1@yahoo.com
13 May 2007 16:57:23 -0700

          From comp.compilers

Related articles
Avoiding Branch Misprediction in Virtual Machine (VM) Portably moron451-compiler1@yahoo.com (2007-05-12)
Re: Avoiding Branch Misprediction in Virtual Machine (VM) Portably anton@mips.complang.tuwien.ac.at (2007-05-13)
Re: Avoiding Branch Misprediction in Virtual Machine (VM) Portably moron451-compiler1@yahoo.com (2007-05-13)
Re: Avoiding Branch Misprediction in Virtual Machine (VM) Portably eliotm@pacbell.net (Eliot Miranda) (2007-05-14)
| List of all articles for this month |

From: moron451-compiler1@yahoo.com
Newsgroups: comp.compilers
Date: 13 May 2007 16:57:23 -0700
Organization: Compilers Central
References: 07-05-04407-05-046
Keywords: VM, interpreter, performance

> Looks like it is a good idea. I implemented a variant of my
> threaded-code microbenchmark using your technique
> <http://www.complang.tuwien.ac.at/forth/threading/repl-switch.c>, and
> here are the results on a 2.2 GHz Athlon 64 X2 4400+ (times in
> seconds):
>
> direct single replic.
> threaded switch switch
> 0.38 1.11 0.51 i386 gcc-2.95
> 0.73 1.11 0.50 i386 gcc-3.3 -fno-crossjumping
> 0.75 1.10 0.54 AMD64 gcc-3.3 -fno-crossjumping
> 0.73 1.10 0.55 AMD64 gcc-4.1


Hey thats not too bad after all!


> The disadvantage is that you have n^2 jumps, which make compilation
> slower, and lower the number of VM instructions you can use (although
> probably not dramatically). Also, you have n replicas of the jump
> tables, which may increase the data cache miss rate.


I got a new Core 2 Duo machine with 4MB cache not too long ago. I'll
have to try your benchmarks out on that system some day.


> Well, maybe the gcc guys will work hard to undo
> the replication and make the replicated switch technique just as slow
> as the ordinary switch dispatch.


Lets just hope they don't try to "improve" things once again like they
did between 2.95 and 3.x.


> AFAIK you are the first to invent this technique. Whom should I
> attribute it to? moron451-compil...@yahoo.com does not sound so
> great:-)


Yea I know :P Moron451 is a throwaway alias to defend against spam.
Emails still come to my main email account but if Moron451 starts
getting hit with too much spam then the alias gives me more options to
keep the spammers at bay. I emailed you the other day on my main
account asking if modern processors and improved compilers were making
threaded code obsolete. Thanks for all of your quick responses by the
way!


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.