benchmark on binary trees

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 6 00:45:10 PST 2015


On 06/12/15 9:35 PM, Alex wrote:
> Ok, lets conclude this post for now. Did some comparison runs with the
> original C++ code. Missed this at the beginning.
> The results so far are as following:
>
> Here is the original code in C++.
> http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=gpp&id=6
>
>
> With modifications to be able to run it on my mac os machine this
> results in the code available here:
> http://pastebin.com/G5cYESdX
> compilation done with
> g++ -c -pipe -O3 -fomit-frame-pointer -march=native -fopenmp main.cpp -o
> main.o && g++ main.o -o main.run -fopenmp -lboost_system
>
> Here you can find the last version of my D code:
> http://dpaste.dzfl.pl/8c8ab00699b5
> compilation done with
> dmd -release -O -boundscheck=off -inline main.d
>
> time comparison, just with
> time ./main
> yields
>
> for C++
> real 0m8.255s
> user 0m7.342s
> sys 0m0.905s
>
> for D
> real 0m35.356s
> user 0m35.149s
> sys 0m0.154s
>
> so the overall factor is round about 5.
>
> Thanks for commenting to everyone! If anybody has further ideas - all of
> them would be appreciated :)
> The original site is not interested in any further languages to be
> tested, so my experiment ends here for now...

Why is TreeNode not final?
Also yours does not use threads in any way.

If you cannot add multithreading on D, remove it from c++ before 
comparing. They are not equal.


More information about the Digitalmars-d-learn mailing list