niklas-heer / speed-comparison

A repo which compares the speed of different programming languages.
https://niklas-heer.github.io/speed-comparison
MIT License
508 stars 79 forks source link

Initial commit for D language #71

Closed cyrusmsk closed 2 years ago

cyrusmsk commented 2 years ago

GCC-family compiler is used (GDC). Currently non-optimal compilation flags are using (without static and lto) as used by C. After checking the possibility to run static and lto build in Alpine - the flags for compilation could be improved.

Also if the comparison with LLVM-based will be accepted it is possible to add LDC compiler (LLVM-based D compiler)

niklas-heer commented 2 years ago

@cyrusmsk I would add a LLVM version as a second entry. Then there is also the comparison possible between the different compilers.

niklas-heer commented 2 years ago

@cyrusmsk I didn't see it at frist, but you probably need to rebase. I rewrote how I do the tests. I'm now using hyperfine instead of my custom scbench tool, and create the needed metadata with a new scmeta tool. Furthermore, I've also introduced "functions" to the Earthfile. (see #66)

This should work for your scenario:

d:
  FROM +alpine
  # RUN apk add --no-cache ldc gcc ldc-static binutils-gold
  RUN apk add --no-cache gcc-gdc

  COPY ./src/leibniz.cpp ./
  # RUN --no-cache cc=gcc ldc2 -O3 -release -mcpu=native -flto=full -linker=gold -flto-binary=/usr/bin/ld.gold -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -m64 -static leibniz.d
  RUN --no-cache gdc leibniz.d -o leibniz -O3 -frelease -march=native
  DO +BENCH --name="d" --lang="D (GDC)" --version="gdc --version" --cmd="./leibniz"
cyrusmsk commented 2 years ago

@niklas-heer Thanks for pointing out on the update of bench system. Now the PR should be inline with the master. Actually it is exactly how you propose in your comment

niklas-heer commented 2 years ago

@cyrusmsk you are very welcome 👍 Thank you for updating it. Glad to hear that it worked as intended 🙂

niklas-heer commented 2 years ago

@cyrusmsk thank you very much for your contribution! 👍 combined_results