[libcxx-dev] Fwd: libcxx performance issue
Yan Yichen via libcxx-dev
libcxx-dev at lists.llvm.org
Sun Aug 25 14:15:49 PDT 2019
Sorry for missing that, it's one (randomly selected) STL #include <vector> with an empty main function as below:
$ perf stat -a -- clang++ -o /dev/null --compile -std=c++11 test.cc<http://test.cc>
Performance counter stats for 'system wide':
6286.898000 cpu-clock (msec) # 7.984 CPUs utilized
1,029 context-switches # 0.164 K/sec
23 cpu-migrations # 0.004 K/sec
5,069 page-faults # 0.806 K/sec
3,359,820,123 cycles # 0.534 GHz
3,011,112,580 instructions # 0.90 insn per cycle
565,470,025 branches # 89.944 M/sec
3,667,572 branch-misses # 0.65% of all branches
0.787455804 seconds time elapsed
$ perf stat -a -- clang++ -o /dev/null --compile -std=c++11 -stdlib=libc++ test.cc<http://test.cc>
Performance counter stats for 'system wide':
20095.100787 cpu-clock (msec) # 7.995 CPUs utilized
1,128 context-switches # 0.056 K/sec
44 cpu-migrations # 0.002 K/sec
7,716 page-faults # 0.384 K/sec
11,861,997,273 cycles # 0.590 GHz
10,930,520,024 instructions # 0.92 insn per cycle
2,064,359,090 branches # 102.729 M/sec
10,959,608 branch-misses # 0.53% of all branches
2.513417717 seconds time elapsed
$ clang++ -o libstdcxx.o -std=c++11 test.cc<http://test.cc>
$ clang++ -o libcxx.o -std=c++11 -stdlib=libc++ test.cc<http://test.cc>
$ ldd libstdcxx.o
linux-vdso.so.1 (0x00007fff3efc7000)
libstdc++.so.6 => /home/yiyan/.local/lib64/libstdc++.so.6 (0x00007fb320d6f000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb3209d1000)
libgcc_s.so.1 => /home/yiyan/.local/lib64/libgcc_s.so.1 (0x00007fb3207b9000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb3203c8000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb32114e000)
$ ldd libcxx.o
linux-vdso.so.1 (0x00007fffd8fe4000)
libc++.so.1 => /home/yiyan/.local/lib/libc++.so.1 (0x00007f01bbcba000)
libc++abi.so.1 => /home/yiyan/.local/lib/libc++abi.so.1 (0x00007f01bba65000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f01bb6c7000)
libgcc_s.so.1 => /home/yiyan/.local/lib64/libgcc_s.so.1 (0x00007f01bb4af000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f01bb0be000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f01bae9f000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f01bac97000)
/lib64/ld-linux-x86-64.so.2 (0x00007f01bbfc8000)
$ cat test.cc<http://test.cc>
#include <vector>
int main() {}
Yichen
On Aug 25, 2019, at 10:47 PM, Eric Fiselier <eric at efcs.ca<mailto:eric at efcs.ca>> wrote:
You would need to tell us what you're actually compiling before we can guess at the problem.
/Eric
On Sat, Aug 24, 2019 at 2:28 PM Yan Yichen via libcxx-dev <libcxx-dev at lists.llvm.org<mailto:libcxx-dev at lists.llvm.org>> wrote:
Dear developers,
Sorry to bother you, but I’ve met a wired problem using clang with libcxx.
I’ve built clang and libcxx with clang, and trying to compile c++ program with libc++, but compilation is extremely slow when using libcxx, as below:
$ time clang++ -o /dev/null -std=c++11 -stdlib=libc++ test.cc<http://test.cc>
clang++ -o /dev/null -std=c++11 -stdlib=libc++ test.cc<http://test.cc> 4.29s user 0.06s system 97% cpu 4.476 total
$ time clang++ -o /dev/null -std=c++11 test.cc<http://test.cc>
clang++ -o /dev/null -std=c++11 test.cc<http://test.cc> 1.41s user 0.06s system 92% cpu 1.582 total
I wonder if you have any idea where should I start to address this issue, or anything I probably configured wrong? Thanks in advanced.
Best,
Yichen
_______________________________________________
libcxx-dev mailing list
libcxx-dev at lists.llvm.org<mailto:libcxx-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20190825/c0174e1a/attachment.html>
More information about the libcxx-dev
mailing list