[MLton] s->alignment considered harmful
    Florian Weimer 
    fweimer at bfk.de
       
    Tue Oct  2 09:33:59 PDT 2007
    
    
  
Storing s->alignment in a variable means that the alignment code in
util/align.h uses full integer divisions to perform the alignment.
Consequently, any allocation-intense program mainly stresses the
integer divider.  A simple s/s->alignment/4/ (assuming that the
default alignment value is 8 on i386) leads to a 60% speed increase
for examples/thread-switch.sml on a slightly dated Opteron.
The best option seems to be to compile the GC multiple times, for each
alignment choice.  Alternatively, the util/align.h could be tweaked to
assume power-of-two alignment, or the alignment could be stored as a
mask.
I think this accounts for the slowdown that has been observed after
the x86_64 branch merge.
-- 
Florian Weimer                <fweimer at bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99
    
    
More information about the MLton
mailing list