[m-dev.] speed effects of --optimize-constructor-last-call for hlc

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Oct 17 18:03:52 AEST 2005


Here is the result of some preliminary benchmarking of
--optimize-constructor-last-call for the hlc backend:

EXTRA_MCFLAGS = -n- -O2
GRADE = hlc.gc
mercury_compile.01 average of 6 with ignore=1     37.62
EXTRA_MCFLAGS = -n- -O2 --optimize-constructor-last-call
GRADE = hlc.gc
mercury_compile.02 average of 6 with ignore=1     37.59
EXTRA_MCFLAGS = -n- -O3
GRADE = hlc.gc
mercury_compile.03 average of 6 with ignore=1     36.93
EXTRA_MCFLAGS = -n- -O3 --optimize-constructor-last-call
GRADE = hlc.gc
mercury_compile.04 average of 6 with ignore=1     37.68
EXTRA_MCFLAGS = -n- -O4
GRADE = hlc.gc
mercury_compile.05 average of 6 with ignore=1     36.40
EXTRA_MCFLAGS = -n- -O4 --optimize-constructor-last-call
GRADE = hlc.gc
mercury_compile.06 average of 6 with ignore=1     35.95
EXTRA_MCFLAGS = -n- -O5
GRADE = hlc.gc
mercury_compile.07 average of 6 with ignore=1     37.34
EXTRA_MCFLAGS = -n- -O5 --optimize-constructor-last-call
GRADE = hlc.gc
mercury_compile.08 average of 6 with ignore=1     36.74

As you can see the effect is a speedup at some optimization levels
(-O2, -O4, and -O5) and a slowdown at other optimization levels (-O3).
This is similar to the effect for asm_fast.gc (though the levels with
speedups differ).

I was intrigued by the slowdown, even without --optimize-constructor-last-call,
from -O4 to -O5, so I did some more benchmarking. For each of option setting
that differs between -O4 and -O5, plus --optimize-constructor-last-call,
I tested its effect separately:

EXTRA_MCFLAGS = -O4
GRADE = hlc.gc
mercury_compile.01 average of 6 with ignore=1     35.51
EXTRA_MCFLAGS = -O4 --optimize-repeat=5
GRADE = hlc.gc
mercury_compile.02 average of 6 with ignore=1     35.52
EXTRA_MCFLAGS = -O4 --delay-construct
GRADE = hlc.gc
mercury_compile.03 average of 6 with ignore=1     35.57
EXTRA_MCFLAGS = -O4 --inline-compound-threshold=100
GRADE = hlc.gc
mercury_compile.04 average of 6 with ignore=1     35.89
EXTRA_MCFLAGS = -O4 --higher-order-size-limit=40
GRADE = hlc.gc
mercury_compile.05 average of 6 with ignore=1     36.13
EXTRA_MCFLAGS = -O4 --eliminate-local-vars
GRADE = hlc.gc
mercury_compile.06 average of 6 with ignore=1     35.65
EXTRA_MCFLAGS = -O4 --loop-invariants
GRADE = hlc.gc
mercury_compile.07 average of 6 with ignore=1     36.06
EXTRA_MCFLAGS = -O4 --optimize-constructor-last-call
GRADE = hlc.gc
mercury_compile.08 average of 6 with ignore=1     36.22
EXTRA_MCFLAGS = -O5
GRADE = hlc.gc
mercury_compile.09 average of 6 with ignore=1     37.23

EXTRA_MCFLAGS = -O4
GRADE = asm_fast.gc
mercury_compile.10 average of 6 with ignore=1     36.19
EXTRA_MCFLAGS = -O4 --optimize-repeat=5
GRADE = asm_fast.gc
mercury_compile.11 average of 6 with ignore=1     36.08
EXTRA_MCFLAGS = -O4 --delay-construct
GRADE = asm_fast.gc
mercury_compile.12 average of 6 with ignore=1     36.16
EXTRA_MCFLAGS = -O4 --inline-compound-threshold=100
GRADE = asm_fast.gc
mercury_compile.13 average of 6 with ignore=1     35.91
EXTRA_MCFLAGS = -O4 --higher-order-size-limit=40
GRADE = asm_fast.gc
mercury_compile.14 average of 6 with ignore=1     37.28
EXTRA_MCFLAGS = -O4 --eliminate-local-vars
GRADE = asm_fast.gc
mercury_compile.15 average of 6 with ignore=1     36.31
EXTRA_MCFLAGS = -O4 --loop-invariants
GRADE = asm_fast.gc
mercury_compile.16 average of 6 with ignore=1     36.02
EXTRA_MCFLAGS = -O4 --optimize-constructor-last-call
GRADE = asm_fast.gc
mercury_compile.17 average of 6 with ignore=1     37.90
EXTRA_MCFLAGS = -O5
GRADE = asm_fast.gc
mercury_compile.18 average of 6 with ignore=1     36.29

Note that this shows that --optimize-constructor-last-call leads to a slowdown
at -O4, contradicting the previous set of benchmarks, which were taken with
compiler versions only a few days apart.

Note also that --higher-order-size-limit=40 seems to be bad for performance;
I don't (yet) know why.

Zoltan.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list