interpreter vs. compiled

castironpi castironpi at gmail.com
Sat Aug 9 00:47:42 EDT 2008


On Aug 5, 2:09 pm, "paulo.jpi... at gmail.com" <paulo.jpi... at gmail.com>
wrote:
> Regarding exploring processor instructions.
>
> Lets say you compile a C program targeting x86 architecture, with
> optimizations
> turned on for speed, and let the compiler automatic select MMX and SSE
> instructions
> for numeric code.
>
> I have now a program that executes very fast, and does what I want
> very well. Now
> when I execute it on a x86 processor with the new SSE 4 instructions,
> it will not
> matter, because it cannot take advantage of them.
>
> With a JIT is different. Assuming that the JIT is also aware of the
> SSE 4 instructions,
> it might take advantage of this new set, if for a given instruction
> sequence it is better
> to do so.
>
> For the usage of the profile guided optimizations, here go a few
> examples.
>
> The JIT might find out that on a given section, the vector indexes are
> always correct, so
> no need for bounds verification is needed. Or if the language is a OOP
> one, it might come
> to the conclusion that the same virtual method is always called, so
> there is no need for
> a VMT lookup before calling the method, thus it replaces the already
> generated code by
> a direct call.
>
> Or that a small method is called enough times, so it would be better
> to inline it instead.
>
> Here are a few papers about profile guided optimizations:
>
> http://rogue.colorado.edu/EPIC6/EPIC6-ember.pdfhttp://www.cs.princeton.edu/picasso/mats/HotspotOverview.pdf
>
> Of course most of these optimizations are only visible in applications
> that you use for longer
> that 5m.
>
> --
> Paulo

There are two things I can emphasize after reading the papers and your
post.

One is the benefit of distributing an incompletely compiled module,
which is that it makes machine-targeted specializations possible right
then and there, and does not require recompiling from the source on
the original author's/distributor's budget.  Even if there's no
YOURSUITE.EXE built, the code is still in a state where you can make
one, by only needing JIT.LIB on your machine.

The second is the massive use of lightweight profiling in choosing
optimizations in JIT.  One of the advantages is inlining common
function sequences, that you would either have to detect yourself, or
inline everything, to achieve.  What are some others?



More information about the Python-list mailing list