[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/mal mal_interpreter.mx, , 1.197, 1.198

Martin Kersten Martin.Kersten at cwi.nl
Fri Sep 28 19:10:28 CEST 2007

Stefan Manegold wrote:
> On Fri, Sep 28, 2007 at 04:01:00PM +0000, Martin Kersten wrote:
>> Update of /cvsroot/monetdb/MonetDB5/src/mal
>> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5547
>> Modified Files:
>> 	mal_interpreter.mx 
>> Log Message:
>> Split the interpreter in two versions. A FAST and SLOW version.
>> If there is no request for debugging or performance measurement
>> outstanding, we can go the fast path. However, given the fact
>> that at any time we may enter the debugger, a jump to the slow
>> line is always possible.
>> The code relies on compiler optimization to get rid of blocks
>> with constant arguments. Unclear if all compilers are that smart.
> All C-compilers (respetively their C preprocessors) are expected to respect
> C preprocessor directives (e.g., #if ... #endif), "even" with optimization
> disabled.
> Hence, why not use those compile-time conditionals instead "pseudo"-runtime
> conditionals with constant conditions? 
> (Would also speed-up the compilation process...)
No. The point is that there should be two execution paths! If possible 
the fast path is executed
until you issue e.g. a mdb.start(), mdb.setTrace(true),...or 
profiler.start() command,
Then it falls back to the slow thread.

The test for the compilers is to remove code fragments like
if(0){ do some work}
Or at least be fast on this switch. This avoids manual copying large 
pieces of code.

Microbenchmarks have confirmed significant improvement.

More information about the developers-list mailing list