New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building chrome with libc++ takes 22% (7 minutes) longer than building it with libstdc++ #14959
Comments
Clang -print-stats diff for libjingle_peerconnection.channel.o with libstdc++ and libc++ |
I had tested compilation time for all combinats of clang, gcc with libcxx and libstdc++ . The compiled code was short: #include int main() { I repeated every run few times and got consistent results. The results attached.
|
Which gcc/libstdc++ are you comparing against? |
Looks like things haven't improved much: λ clang -v λ g++ -v λ cat t.cpp int main() { λ time clang++ t.cpp λ time g++ t.cpp |
It would be unfair to compare g++ w/ libstdc++ and clang w/ libc++. I'll look into comparing the same clang with both libstdc++ and libc++. However this is very low on my priority list. |
Well thats only a 1x slowdown: λ time clang++ -std=c++11 -stdlib=libstdc++ t.cpp λ time clang++ -std=c++11 -stdlib=libc++ t.cpp |
I don't really think that this is a bug. I think that we have been comparing different things. First, some timings that I just did. (All of these, I ran several times) $ time totclang -c -std=c++11 -stdlib=libstdc++ bug.cpp real 0m0.187s $ time totclang -c -std=c++11 -I /Sources/LLVM/llvm/projects/libcxx/include bug.cpp real 0m0.346s Seems pretty straightforward, right? But that's comparing libstdc++ 4.2.1, a C++03 standard library implementation, to ToT libc++ a C++11 library implementation. The C++11 standard library is much larger. So, let's compare apples to apples. Let's look at more modern libstdc++ versions - ones that implement the full C++11 standard library. (Note that libstdc++ didn't get most of the C++11 stuff until 4.8.x, and didn't really have all of it until 5.1) $ time totclang -c -std=c++11 -I /Sources/gcc/gcc-4.9.2/bin/include/ bug.cpp real 0m0.344s $ time totclang -c -std=c++11 -I /Sources/gcc/gcc-5.1.0/bin/include/ bug.cpp real 0m0.345s Now the difference is about 1 ms - probably less than the uncertainty in the timing. I would appreciate it if others would try this, and see if it matches my findings; but I'm tempted to close this as "works for me". |
Similar results on Linux with ToT clang and gcc 5-branch. |
Closing because no one disputed my "works for me" examples in a year. |
Extended Description
I tried building chrome with libc++ (since we need to ship on 10.6, with a libc++ set to "all symbols hidden", and statically linked -- https://codereview.chromium.org/11468030/ see . This is research only for now.)
Doing a full build of the 'chrome' target consistently takes longer with libc++ than with libstdc++ (with clang r168474). Building with libc++ takes around 38 minutes, building with libc++ takes around 31 minutes. (I built several times with both configurations, and the numbers varied by 50s. I interleaved the builds, so it's unlikely that this is explainable by some big background job taking up a huge amount of cpu).
I'm attaching the .ninja_log file for both builds. The format is "start timestamp in ms, end timestamp in ms, 0, output path, hash". With that file, it should be possible to find out for which files the difference is biggest.
The text was updated successfully, but these errors were encountered: