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

Re: Scripting



Steve Baker wrote:
> I think this is a ridiculous claim - and if it were remotely likely to be
> true then that's how C++ compilers would work.  You'd compile the program
> offline - optimise it the best you possibly could with static knowledge of
> the nature of the program - then keep a copy of the code and re-optimise
> it based on this nebulous "additional information" that somehow becomes
> available.

However, that /is/ how some C++ compilers can cheerfully work.
Take a recent GCC with -fprofile-arcs; it will, for example give
its best guesses concerning the liklihood of various branches being
taken for a 'first pass' executable, load the executable with
instrumentation whereby running the program gathers actual
branching statistics which can be fed back into another compilation
pass for better block-ordering for fewer branches.

Now take the same idea but apply it dynamically so that the
machine code generated on the fly can be adapted to a per-run
usage pattern instead of statistics gathered from a single run,
and you can see why it could be possible to generate better
code on-the-fly for a session's usage pattern than static
optimizations.

Of course, dragging this back on-topic, that very likely
sucks for games for the same reasons that garbage collection
potentially could: very lousy determinism.

--Adam
-- 
Adam D. Moss    . ,,^^    adam@gimp.org    http://www.foxbox.org/   co:3

The only winning move is not to play.