[llvm-dev] microbenchmark shows 3-6x perf loss w/ LLVM vs GCC at -O3, >1.5x w/ -flto

Micah Villmow via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 3 07:09:20 PDT 2017

I was doing some micro benchmarking for a code path that w/ profiling was
showing to take up a large portion of execution time. I narrowed down the
code to querying the configuration database extracted the attached
testcase. While seeing what was the optimal pattern performance wise, I
noticed that clang was dramatically slower than gcc

While -flto does help, the perf delta is still 2x.

Attached is test case and run script.

CPU: Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
gcc: g++ (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
clang4.0: clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1)
clang5.0: clang version 5.0.0 (tags/RELEASE_500/final)

O3 g++: .334s & .542s
O3 clang++4.0: 1.866s & 1.866s

O3 LTO g++: .341s & .343s
O3 LTO clang++4.0: .554s & .797s

I also downloaded llvm 5.0 really quick and got this:
O3 clang++5.0: 1.583s && 1.679s

There was no LLVMGold.so w/ the 5.0 downloads, so I didn't get any numbers

Hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171103/ef5ec4d8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: option_config_perf.tar.gz
Type: application/x-gzip
Size: 1111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171103/ef5ec4d8/attachment.bin>

More information about the llvm-dev mailing list