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

Re: Diversity - existence, value, and pursuit.



quoth Scott McKay <swm@hotdispatch.com>:
> Actually, it is no longer obvious to me that a VM is necessarily
> slower than

I had expected someone to comment on this, but I was expecting someone
to bring up what I still consider to one of the coolest hacks around:
HP's dynamo (first hit on google) project. Basically, it applies
SELF's profile-feedback-driven optimisation to native code. The
punchline is that even paying the overhead of gathering profiling
information AND generating optimised code at runtime, it still beats
the pants off statically optimised native code. 

I would expect that this technique would be even more effective when
the input instruction stream was for a VM; since you've already
incurred dispatching overhead, profiling should be cheap. Sun's
Hotspot does something along these lines. 

Why Hotspot fails to reach the fabled "speed of C" is another issue.
Maybe it does? (Lore has it that it gets faster over timeframes
measured in hours) Of course, we're not comparing apples to apples
here, as both programming style and runtime overhead will be different
between C and Java. I dunno. But the moral of the story is that once
you have a JIT framework in place, you can reach some really tasty
low-hanging fruit by gathering and using just a little profiling
information.

Now for the blue sky I-wish-I-had-more-time idea:

Transmeta do all this in hardware; translating x86 code to whatever
they call their internal architecture. This gives them an edge that no
other JIT technology has: they could conceivably inline kernel code,
because both kernel mode and user mode are reified for them.

Of course, this would require more than a little analysis to make sure
you're not creating a huge security hole. But if you're running a
server, being able to optimize accross that boundary could more than a
little useful. Of course, transmeta and RLX (the transmeta-using
server manufacturer are racing to see who can file for chap-11 first,
so this is all academic). Oh wait. So am I.