A benchmark, mostly GC
Marco Leise
Marco.Leise at gmx.de
Sun Dec 18 13:57:53 PST 2011
Am 11.12.2011, 14:48 Uhr, schrieb bearophile <bearophileHUGS at lycos.com>:
> This program used here as a benchmark is a bit reduced from a
> rosettacode task, it finds how many ways are there to make change for
> 100_000 euro (the argument 'amount' represents cents of euro) using the
> common coins.
>
> The result is:
> 992198221207406412424859964272600001
>
> The timings, best of 3, seconds:
> DMD: 22.5
> Python: 9.3
> Java: 2.9
>
> DMD 2.057beta, -O -release -inline
> Java SE 1.7.0_01-b08 (used without -server)
Is -server still doing anything? I thought that behavior was default now.
> Python 2.6.6
> 32 bit Windows system.
Since I'm on a 64-bit machine I changed all int to ptrdiff_t first, for
compatibility. And I am using DMD 2.056.
dmd -inline -O -release
gives me 21.680s (pretty similar)
dmd -L-O1 -L-znodlopen -L-znorelro -L--no-copy-dt-needed-entries -L--relax
-L--sort-common -L--gc-sections -L-lrt -L--as-needed -L--strip-all -inline
-O -release -noboundscheck
gives me 18.674s (black magic or something, but note worthy; shaves off 3
seconds for me)
gdc -Wall -frelease -fno-assert -fno-bounds-check -ffunction-sections
-fdata-sections -flto -march=native -O3 -Wl,--strip-all -Wl,-O1
-Wl,-znodlopen -Wl,-znorelro -Wl,--no-copy-dt-needed-entries -Wl,--relax
-Wl,--sort-common -Wl,--gc-sections -Wl,-lrt -Wl,--as-needed
gives me 14.846s
-> The choice of compiler and parameters can have an unexpected impact on
the runtime performance. :)
But let's take a look at the non-inlined dmd version to do some
(o)profiling (attached file).
Looking at the call graphs, it looks to me like a total of ~63 % of the
time is spend in memory management routines while the rest goes to BigInt.
I don't have a set up here to quickly check out 2.057. The numbers may
differ significantly there, but that alone wont close the gap to Java
(which I actually find impressive here, how do they do this?)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oprofile.zip
Type: application/x-zip-compressed
Size: 3138 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111218/03672ecd/attachment.bin>
More information about the Digitalmars-d
mailing list