Related articles |
---|
Indirect threading other than GCC? heng@ag.arizona.edu (Heng Yuan) (2001-12-08) |
Re: Indirect threading other than GCC? anton@mips.complang.tuwien.ac.at (2001-12-09) |
Re: Indirect threading other than GCC? nickgeo@merle.acns.nwu.edu (Nicholas Geovanis) (2001-12-11) |
Re: Indirect threading other than GCC? anton@mips.complang.tuwien.ac.at (2001-12-15) |
From: | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
Newsgroups: | comp.compilers |
Date: | 9 Dec 2001 21:55:46 -0500 |
Organization: | Institut fuer Computersprachen, Technische Universitaet Wien |
References: | 01-12-034 |
Keywords: | C, optimize |
Posted-Date: | 09 Dec 2001 21:55:46 EST |
Heng Yuan <heng@ag.arizona.edu> writes:
[indirect threaded code]
>Also, how much faster does it improve upon switch threading? Assume
>that the cases are all consecutive integers starting from 1. The
>number of cases can be from several to hundreds.
Results for a micro-benchmark are available at
<http://www.complang.tuwien.ac.at/forth/threading/>, but I would not
trust the results on CPUs with BTBs (the microbenchmark has
unrealistic prediction accuracy).
Results for real interpreters simulated on SimpleScalar with various
branch prediction schemes can be seen on
<http://www.complang.tuwien.ac.at/papers/ertl%26gregg01.ps.gz>. There
is no direct comparison of indirect threaded code to switch dispatch
there, but the slowdown of indirect threaded code over direct threaded
code is less than 20% for Gforth (depending on the machine); my guess
is that it would be in the same area for Ocaml and somewhat less for
Yap. Anyway, the results for SimpleScalar with a mispredict penalty
of 4 cycles, for currently available branch predictors, are that
switch dispatch costs 4.1-6.6 cycles more than direct threaded code,
resulting in a slowdown factor of up to 2.02.
Another comparison is available at
<http://www.complang.tuwien.ac.at/forth/performance.html>. Gforth uses
direct threaded threaded code (with indirect threaded code less than
10% slower on that machine), whereas thisForth uses switch dispatch
and is 3-4 times slower; however, thisForth contains other
inefficiencies besides switch dispatch, so this result is only useful
as an upper bound on the speed difference.
- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/home.html
Return to the
comp.compilers page.
Search the
comp.compilers archives again.