3 ms·
rust uses LLVM (a C++ library) as a backend; nim uses clang (a compiled C++ executable) as a backend. While there are differences, neither is clearly superior.
by beagle3 12y ago
rust uses LLVM (a C++ library) as a backend; nim uses clang (a compiled C++ executable) as a backend. While there are differences, neither is clearly superior.
Generally, the LLVM route will be faster/more compact when compared to Clang. However, nim can just as easily use gcc, or MSVC, or tcc, which rust cannot. Especially with respect to tcc, this means a stand-alone all-inclusive nim compiler executable can quite easily be constructed and will probably be ~1MB, whereas the comparable standalone rust compiler rustc executable is likely to clock in at 20MB. And you know what? That makes no difference in today's world.
Edit: made it explicit that I am talking about the compiler itself (which was the subject of the parent post I was replying to).
I estimated that the rustc will be 20MB based on my experience with linking LLVM statically in the past - I have not tried it recently, nor have I built rustc. I might be way off. Kibwen says his rust compiler clocks at 8MB - so it appears I am way off (or maybe comparing an unstripped executable to a stripped one)
To be clear to child comment: I did NOT intend to claim that writing something in C will provide a 95% reduction of code size.
- nine_k 12y agoWhat would make a standalone Rust executable 20 MB in size? Last time I checked, Rust did not expect to carry libc with it, and can run entirely without a runtime.
- kibwen 12y agoFor purposes of comparison, the Rust compiler (which is the most extensive Rust program on my computer at the moment) clocks in at 8MB. EDIT: Servo, which is the largest Rust program in existence at the moment, is 21MB. Personally I doubt the above claim that writing this in C would reduce the binary size by 95%. I obviously don't have any statically-linked written-in-C web browsers on hand, but if I poke around in Chrome's install directory I see 85MB of DLLs (the entire directory is about 475MB, though surely not all of that is due to binaries).
- beagle3 12y agoI am Updated my comment (GP) to indicate I was talking entirely about compiler size, not executable product size. Is the 8MB rust compiler statically or dynamically linked to LLVM? It's been a few years, but I never got a statically linked LLVM-using program below 30MB (unstripped, I think stripped was 16MB but I don't remember)