At Thu, 22 Mar 2001 13:37:29 -0800,
John Harper wrote:
>
> |> I've looked, a little, (and months ago at that) at the LibREP (ala
> |> "sawfish") virtual machine. It's a pretty good indirect threaded VM
> |> that uses techniques pioneered by Forth engines. It utilizes the GCC
> |> ability to take the address of a label to build a jump table indexed
> |> by opcode. Very efficient.
> |
> |It is not very portable. I don't believe it will be any faster than
> |switch case.
>
> IIRC it was at least 10% faster; portability is maintained by falling
> back to switch on non-gcc systems
In my experiment with Guile VM (which uses the same technique as rep's),
it is 50% faster:
[ labels as values ]
gcil@user> ,time (fib 30)
$1 = 1346269
clock utime stime cutime cstime gctime
3.14 3.02 0.12 0.00 0.00 0.00
[ switch ]
gcil@user> ,time (fib 30)
$1 = 1346269
clock utime stime cutime cstime gctime
4.76 4.70 0.06 0.00 0.00 0.00
This is a result of 30,000,000 VM instruction calls and purely
reflects the difference between the two, I believe.
Kei