Skip to content

LaurentChardon/llvm-benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llvm-benchmark

Benchmark that compiles llvm with clang to assess the speed of a compilation platform. It is multiplatform and has so far been tested in Linux (x86-64), FreeBSD (arm64) and MacOS (x86-64,M1).

How it works

There are four stages in the process:

  1. llvm-project: get the llvm source code with git
  2. llvm-bootstrap: do a first compilation of clang with the system's C and C++ compilers
  3. llvm: use the compiler from the previous stage to compile clang with itself
  4. benchmark: use the compiler from the previous stage to time the compilation of llvm, clang and flang-new

Each stage is a target in the Makefile, and can be targeted individually. If the make process is interrupted, when it is resumed it will restart from the beginning of the last stage that was not completed, rather than resume where it was interrupted.

Usage

Simply type make to go through all stages. This will use the platform default compilers, all the system's threads in stages 2 and 3, and 4 threads for the benchmark stage. On Linux the GNU compilers will be used by default, and on BSD and MacOS, clang will be used.

More control can be obtained by specifying some parameters:

  • TIMINGS can be used to change the file where timings are recorded. By default it is in timings.txt
  • THREADS can be used to change the number of compiler threads used in the benchmark stage

For example, to compile stage 2 with clang on Linux, and use 8 threads for the benchmark stage:

make THREADS=8

Sample results

See Results.md for some sample timings.

Notes

Currently, flang-new is not very mature, and its compilation requires a large amount of RAM. For this reason, you might have to lower the THREADS parameter to not exceed your available memory. flang-newis only compiled in the benchmark phase.

The make utility that comes with MacOS is currently 17 years old and is not compatible with this project. You will have to install a newer make, possibly from Homebrew or MacPort.

About

LLVM compiler speed benchmark

Resources

License

Stars

Watchers

Forks