[Fwd: Re: [Discuss] Interpreters vs Compilers]
pw
p.willis at telus.net
Thu Mar 13 16:16:57 PDT 2008
David Bronaugh wrote:
>
> The Python interpreter compiles Python code to bytecode, and then the VM
> runs it.
>
> FWIW, the Java VM (1.3, at least) is about 4x slower than C/C++ when I
> tested it. The Ocaml bytecode interpreter is about 18x slower. I haven't
> done any playing around with Python bytecode, but I would assume it'd
> fall somewhere in between those two speeds.
>
> The only really fair way to test how much better a bytecode interpreter
> is, is to test it on a short bit of code that takes very little time to
> convert to bytecode, but takes a proportionally much longer time to run.
> Then you see the full advantages without confounding effects of the time
> required to convert to bytecode.
>
> It's true what pw says; at least in theory, it should be possible for
> bytecode to run as fast as native. But in practice it doesn't tend to
> work out that way.
>
> David
The optimization of the virtual machine is the killer for any type of
emulation.
I would suggest that JVMs get different benchmarks on various CPUs
for the same code due to the quality of optimization in the JVM
and the difference in the number of ticks each instruction takes
comparatively.
Peter
More information about the Discuss
mailing list