Woo Gyun <[EMAIL PROTECTED]> wrote
(26 May 1997 17:17:11 +0900 (KST))
> I'm using GHC 2.02 for DEC Alpha.
> With comparing SML/NJ 1.09 compiler I'm astonished because GHC is
> too late.
> SML/NJ 1.09
> User: 3.992 sec GC: 1.159 sec SYS: 0.431 sec
> GHC 2.02
> INIT time 0.00s ( 0.18s elapsed)
> MUT time 21.97s ( 59.47s elapsed)
> GC time 39.59s (687.23s elapsed)
> Total time 61.56s (746.88s elapsed)
>
> the program is conCATinated two long list, the length of which is
> 131072.
> I've compiled the following program with the option `-O2' and
> executed it with the option `+RTS -S -H100M'.
> The above result is the part of `.stat' file.
> What's going on in GHC ? It's too lazy. Any comments ?
...
>
> main = print list
> list = cat list1 list1
> list1 = [1..131072]
> cat s t = case s of [] -> t
> s:ss -> s : cat ss t
Are you sure that you are mesuring `cat' and not *printing* or, maybe
not integer arithmetics ?
I would rather suggest
---------------------------------------------------------------------
main = print (expConcat n ['x'])
expConcat 0 xs = xs
expConcat n xs = expConcat (n-1) (_scc_ "cat" (cat xs xs))
n = 17
---------------------------------------------------------------------
This was run on ghc-0.29, Linux, PC-486.
At the last step `cat' concatenates the lists of length 2^(n-1).
Here, the elements of lists are uniform, just a letter 'x'. And on
the second, the _scc_ istruction points what particularly has to be
measured.
Compilation: ghc -c -O -prof cat.hs
Link: ghc -o run cat.o -prof
Run: run +RTS -H12m -pT
Mon May 26 14:23 1997 Time and Allocation Profiling Report (Final)
run +RTS -H12m -pT -RTS
total time = 1.38 secs (69 ticks @ 20 ms)
total alloc = 3,146,456 bytes (excludes profiling overheads)
COST CENTRE MODULE scc %time %alloc inner cafs dicts
CAFs_in_... Main 2 55.1 50.0 17 2 0
MAIN MAIN 1 26.1 0.0 0 4 0
cat Main 17 18.8 50.0 0 0 0
CAFs_in_... PRELUDE 4 0.0 0.0 0 0 0
So, all the calls of `cat' had taken about 1/5 of 1.38 sec ~= 0.3 sec
of time in sum.
Since I am not sure myself, what the ghc experts say, is this an
appropriate way to bechmark the concatenation?
Sergey Mechveliani [EMAIL PROTECTED]