[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] [Fwd: Re: lightning for x86-64???]

From: Matthew Flatt
Subject: Re: [Lightning] [Fwd: Re: lightning for x86-64???]
Date: Thu, 26 Oct 2006 22:10:20 0800

At Thu, 26 Oct 2006 09:37:38 +0200, Ludovic Courtès wrote:
> Are there documents or mailing list posts roughly describing how you're
> using Lightning in MzScheme and (optionally) providing performance
> comparisons with `mzc'?  I'm quite curious.  ;-)

MzScheme compiles Scheme source to bytecode, and then either interprets
the bytecode or compiles bytecode to native code via a lightning-based

Most code generated by the JIT works the same way as the interpreter.
In other words, the JIT acts as a kind of partial evaluator with
respect to the interpreter and specific bytecode. Code is JIT-compiled
the first time a closure containing the code is applied; the code is
compiled once for all closures that use the same code.

For better performance, some primitives are inlined in JIT-compiled
code, such as `car' or `+', just as you'd expect. Also, function calls
uses a few different protocols for different kinds of targets:
primitives, other JIT-compiled procedures (tail calls use a jump,
non-tail calls use the C calling conventions), and self tail calls (a
jump, without unpacking the closure again). Those two kinds of
optimizations provide most of the performance gain.

Here are some benchmark results comparing mzc and the JIT:

"mzscheme-j" means MzScheme without the JIT. Except for the "fastest"
column, the big numbers are relative run times, and the small gray
numbers are relative compile times. The "fastest" column shows the
actual times for the fastest in each case.

For more information about the benchmarks, as well as comparisons of
MzScheme (JIT enabled) to other Scheme implementations, see


reply via email to

[Prev in Thread] Current Thread [Next in Thread]