nordlow / compiler-benchmark

Benchmarks compilation speeds of different combinations of languages and compilers.
MIT License
138 stars 18 forks source link

Add ocaml compiler support #2

Closed Kakadu closed 4 years ago

Kakadu commented 4 years ago
Language Templated Oper Exec Path Exec Version Time [s] Time vs D
D No Check /usr/bin/dmd v2.093.0 0.098 N/A
D Yes Check /usr/bin/dmd v2.093.0 0.190 N/A
D No Build /usr/bin/dmd v2.093.0 0.218 N/A
D Yes Build /usr/bin/dmd v2.093.0 0.299 N/A
C No Check /usr/bin/gcc-8 8.4.0 0.067 0.7
C No Check /usr/bin/gcc-9 9.3.0 0.096 1.0
C No Check /usr/bin/clang-8 8.0.1 0.220 2.3
C No Check /usr/bin/clang-9 9.0.1 0.244 2.5
C No Build /usr/bin/gcc-8 8.4.0 2.815 12.9
C No Build /usr/bin/gcc-9 9.3.0 3.213 14.8
C No Build /usr/bin/clang-8 8.0.1 1.323 6.1
C No Build /usr/bin/clang-9 9.0.1 1.420 6.5
OCaml No Build ~/.opam/4.07.1+fp+flambda/bin/ocamlopt 4.07.1 5.907 27.1
nordlow commented 4 years ago

Thanks!

nordlow commented 4 years ago

@Kakadu: BTW, does OCaml have a checker we could add support for aswell?

Kakadu commented 4 years ago

@Kakadu: BTW, does OCaml have a checker we could add support for aswell?

If checker means parser+typechecker, then answer is no, AFAIU

Kakadu commented 4 years ago

Btw, do you have any recommended reading why D is so fast, @nordlow ? Less optimizations by default? Better quality of generated code? Something else?

nordlow commented 4 years ago

Btw, do you have any recommended reading why D is so fast, @nordlow ? Less optimizations by default? Better quality of generated code? Something else?

Because

  1. The D programming language has been developed with fast compilation in mind from day one. It is a so-called single pass language. D's compilers only have too look at the code once. Despite that its suite of features far exceeds that of C++ when it comes to generic programming, compile-time reflection and introspection, etc.
  2. Walter Bright is a very skilled compiler writer.
  3. DMD has its own backend which is about 10x faster than LLVM at producing object files.

See also https://forum.dlang.org/post/brojqmvtnqyxcfuwflcc@forum.dlang.org.

From a historical perspective, you might also find https://dl.acm.org/doi/abs/10.1145/3386323 interesting.