7 ms·
ELI5... why is this great news (i.e. why is LLVM/CLANG better than GCC -- speed?)
by canada_dry 7y ago
ELI5... why is this great news (i.e. why is LLVM/CLANG better than GCC -- speed?)
- StavrosK 7y agoSee, when a daddy loves a mommy very much, they usually get married. However, sometimes the daddy meets another woman, who is faster, uses less memory, with a significantly less complicated code base, and then the daddy decides to compile his Linux with her instead. Does that help?
- canada_dry 7y agoWell, I did say ELI5. So, thanks, um, I guess.
- StavrosK 7y agoI do strive to be age-appropriate!
- deleted 7y ago[deleted]
- nickik 7y agoDaddy is a dick, he and mommy have grown up together. They share their complex internals with each other and were made for each other. They share even their philosophical stance on code freedom. How can you turn your back on that. Why jump to another woman just because she is thinner and more in demand with with researches?
- cat199 7y ago> They share even their philosophical stance on code freedom arguable. BSD and commercial Unices used PCC and PCC derivitives for much of their history; by this token, GCC is the 'other woman', and this is itself ignoring the clear differences in philosophy between MIT/BSD and GPL licening
- astrange 7y ago> with a significantly less complicated code base This is probably not true (because clang is in C++ it can't be less complicated than anything), and gcc is complicated in some parts because it uses much better algorithms (the LLVM register allocator is not as good as LRA). LLVM also has some very ugly DSLs like the .td files. But GCC's codebase does have lots of added complexity from the extremely weird GNU coding style where they want you to pretend you're writing Lisp and all commits have to update a changelog file. Plus terrible GNU software like autotools and recursive make.
- patrick5415 7y agoI like autotools. So much better than cmake.
- IloveHN84 7y agoThey want to get rid of Stallmann's GNU concepts
- canada_dry 7y agoAh... thx. Found this article by Stallman that gives some context to that: https://www.gnu.org/gnu/thegnuproject.en.html https://www.gnu.org/gnu/thegnuproject.en.html
- kpU8efre7r 7y agoGood riddance
- djsumdog 7y agoReally? I would prefer more things were GPLv3/AGPLv3. Open source today is just a bunch of middleware, but few end products. People today use open source software to build closed source solutions. It's a far cry from what a lot of us envisioned back in the 90s. I wrote about this before: https://penguindreams.org/blog/the-philosophy-of-open-source-in-community-and-enterprise-software/ https://penguindreams.org/blog/the-philosophy-of-open-source...
- tssva 7y agoNow they just need to replace the kernel and almost all of the remaining userland.
- pjmlp 7y agoWhich is always ironic, given that without Stallmann's GNU concepts, Linux would never have happened. And most likely, given the BSD state back then, it would mean we would just keep using either commercial UNIXes, or Windows would have won the UNIX wars. But lets get rid of Stallmann's GNU concepts.
- cat199 7y ago> given the BSD state back then you mean being persecuted by over-bearing commercial unices? (e.g. SVr4 and ATT)? lets not mis-confuse the issues to our personal ends - the argument is just as valid that without BSD UNIX, stallman would also not have a system to base a clone on.. GNU attempts to redefine the existing cultural status quo of open-source software dating from the dawn of computing to its own personal ends
- zamalek 7y agoApart from compiler redundancy, it eliminates the usage of vendor (GCC or Clang) extensions and UB that the two compilers don't agree on. Edit: last I checked (more than two years ago), GCC was faster on more micro-benchmarks.
- jjuhl 7y agoHow does choosing one compiler over another "eliminate use of vendor extensions and UB"? Whatever compiler is chosen you'll have as much UB and as many extensions to deal with, as if the other one had been chosen.
- zamalek 7y agoProvided you have good code coverage, you'll pick up any UB that falls outside the intersection by running tests on both compilers.
- otabdeveloper2 7y agoIt's not great news. GCC is basically better in every way. People promote Clang because it has a permissive license and opens the door for Google and Apple to inject proprietary crap into Linux.
- justinclift 7y agoDoes GCC have a decent WebAssembly backend? Looking around just now, there's what seems like an initial experiment from someone, but it doesn't seem to have gone anywhere. :( https://sourceware.org/ml/binutils/2017-03/msg00044.html https://sourceware.org/ml/binutils/2017-03/msg00044.html Asking because with the LLVM 8.0.0 release (a few months ago) it's one of the standard supported architectures.
- viraptor 7y ago> opens the door for Google and Apple to inject proprietary crap into Linux This doesn't make sense. You can compile proprietary code with gcc without problems already. Clang doesn't enable anything new here.
- rurban 7y agoNo, GCC has serious shortcomings in certain areas. -flto=thin is better, autofdo/bolt is better, the jit is better, but the most important point are C constexpr which are implemented as in C++, but with GCC you cannot decide at compile-time if a constexpr is constant, so it misses out on many optimizations. It only has _Static_assert, but no usable __builtin_constant_p. With GCC it errors at compile-time, with clang it returns 0. clang also has diagnose_if, e.g. to match user-defined compile-time warnings with user-defined run-time warnings. e.g. the clang memcpy can be 100x faster than the gcc memcpy, when the size and alignment is known. And gcc-9 added serious regressions on some platforms, that you need to blacklist it. gcc-10 probably not being better.
- astrange 7y agoWhere do clang and gcc implement memcpy? That's part of the C library.
- 7y ago
- snvzz 7y agoDependency on a specific toolchain is bad for the ecosystem. The existence of a distribution using Clang for building itself makes the ecosystem way stronger.
- djsumdog 7y agoClang has some code base and speed advantages, but the big reason the large players like Apple are grabbing onto it is licensing. A lot of companies really want to move away from any GPL stuff. It's sad since so much of what we have in the Linux ecosystem came from GNU.
- fluffything 7y agoCompiling things with clang is faster and uses less memory. Linux distros, package repositories, etc. are basically giant compilation farms, compiling packages making sure they work well together so that you don't have to. So switching to clang might impact their resource usage. --- For you, the user, the performance of binaries compiled with GCC or clang is pretty much on par. Some binaries are a bit faster with clang, others are a bit faster with GCC, often in negligible ways. If you are doing something that's very resource intensive, recompiling that software yourself tuning it to your use cases is probably going to have a much larger impact on resource usage than whether the shipped package was compiled with gcc or clang.