[m-dev.] structure reuse benchmarks on compiler

Peter Wang novalazy at gmail.com
Tue Aug 19 14:59:56 AEST 2008


Here some numbers on compiling the compiler with intermodule analysis and
structure reuse.

The library and mdbcomp directories were analysed until all the .analysis
files were `optimal'.  The compiler directory was only analysed once through
(see later).

  MCFLAGS += --intermodule-analysis -O5
  EXTRA_MCFLAGS = 
  mercury_compile.01 average of 6 with ignore=1     17.79

  MCFLAGS += --intermodule-analysis -O5
  EXTRA_MCFLAGS = --structure-reuse --structure-sharing-widening 20 --structure-reuse-repeat 3
  mercury_compile.02 average of 6 with ignore=1     17.25

i.e. an improvement of 3.0% on the speedtest, and 5.7% less memory allocated,
as calculated by summing the output of GC_PRINT_STATS=1.

I tried on a few other modules with similar results.  Compiling
frameopt.m was kind of nice: 8.4% faster, 6.2% less memory.

The compiler was 33% bigger:

14911135      10208 4991888 19913231	12fda0f	batchaug.01
19912423      10208 4991888 24914519	17c2a57	batchaug.02


I've had trouble getting the compiler directory analysed over multiple passes.
It would get quite far into the process, but then analysing one more module
would change some result which then invalidates the .analysis files for a
whole heap of modules.  I've let it analyse over a few days (3-4?) but so far
it's not been able to reach a state where all the .analysis files are valid.

I think it's because the structure reuse conditions are quite fragile and that
interacts badly with the module-level granularity we use for intermodule
analysis.  A single extra reuse opportunity may cause the reuse conditions on
the procedure to change, so we need to invalidate modules which call that
procedure.  In the mean time, all the results for the invalidated modules are
invalid, which affects any modules we analyse in the mean time.  The circular
dependencies and submodules in the compiler probably don't help either.

Peter

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list