News for hackers. Stuff that matters.
Re:A Few More Reasons Rust Compiles Slowly by lukevp on Monday June 29, 2020 @02:06PM (#23680339)
What is “slow”? I mostly do JS and .NET, and I just started working through the rust hello world. I was shocked that I had an exe in around 0.2s. I haven’t worked on a large project so maybe this doesn’t scale, but of the 3 (at least for hello world which is fairly trivial) rust felt super fast. I saw mention of Roslyn so perhaps the issue is more around incremental compiles for IDE feedback? I didn’t see any issues with the VS Code language server (and I love the auto format on save, I set this up with prettier and I don’t want to go back to a place without auto formatters for everything. It’s great DX.)
Re:A Few More Reasons Rust Compiles Slowly by tym0 on Monday June 29, 2020 @02:51PM (#23680996)
Depends what you're building, I have what I would consider a small server app (Less than 10 JSON HTTP endpoints with some postgres), a dev incremental build takes 17.21s and a release build 7m 12s. A similar app in Go would probably take less than a second to build, they're obviously quite different languages but that doesn't feel that fast.
Re:A Few More Reasons Rust Compiles Slowly by cptskippy on Monday June 29, 2020 @03:27PM (#23681498)
I'm looking at the pipeline for smallish .NET Core Web App and the 6 projects build vary from 4-25sec each to build and with all the scaffolding it takes just under 5 minutes start-to-finish to produce binaries.
Re:A Few More Reasons Rust Compiles Slowly by xrisk on Monday June 29, 2020 @03:21PM (#23681418)
Is that because the libraries you link to are gigantic? Even so, the compiler shouldn’t be compiling those parts of the libraries that aren’t being used, right?
Re:A Few More Reasons Rust Compiles Slowly by pjmlp on Monday June 29, 2020 @03:51PM (#23681832)
So far cargo doesn't do binary dependencies, so when you start a project, or do CI/CD, it compiles the all world from scratch.
Re:A Few More Reasons Rust Compiles Slowly by chc on Monday June 29, 2020 @03:55PM (#23681870)
I'm not intimately familiar with the internals of rustc, but my impression was that everything gets compiled and dead code is later eliminated. In order to avoid compiling unnecessary stuff, you generally need to use feature flags (e.g. you can say "only compile this if the serialization feature is enabled").
Re:A Few More Reasons Rust Compiles Slowly by tym0 on Monday June 29, 2020 @03:39PM (#23681656)
Actix, Diesel, Serde and their dependencies are definitely most of build time.
Re:A Few More Reasons Rust Compiles Slowly by zozbot234 on Monday June 29, 2020 @02:36PM (#23680781)
> I just started working through the rust hello world. I was shocked that I had an exe in around 0.2s.

It's not everything. It's projects that use a lot of monomorphized generics, or compile-time macros, etc. And to be sure, this situation is improving over time - as new generics-related features are added, hopefully more of the redundant code that gets output when using these features will simply be cleaned up automatically, without adverse impact on compile times.

Re:A Few More Reasons Rust Compiles Slowly by YorickPeterse on Monday June 29, 2020 @03:18PM (#23681378)
To illustrate, let's take the following VM code: https://gitlab.com/inko-lang/inko/-/tree/master/vm. This VM consists of 18 262 lines of code, including VM tests.

An incremental release build where nothing has changed (I just ran `touch src/lib.rs`) takes 25 seconds. Compiling the VM from scratch including all dependencies takes 1 minute and 28 seconds.

That's not too bad, but it could (and in my opinion should be) much better. Debug builds are usually faster to compile, but tend to run too slowly to be useful for anything but debugging some VM bug.

Re:A Few More Reasons Rust Compiles Slowly by fsociety on Monday June 29, 2020 @02:10PM (#23680386)
I think it’s more of a question for compiling programs with LOC in the millions. The compile times for projects like LLVM, Chromium, and Tensorflow for example are disgusting.
Re:A Few More Reasons Rust Compiles Slowly by dkarlovi on Monday June 29, 2020 @02:16PM (#23680481)
What's the rough scale of "disgusting" here?
Re:A Few More Reasons Rust Compiles Slowly by chubot on Monday June 29, 2020 @02:27PM (#23680654)
One observation on LLVM

Building LLVM from source, I was told in another forum, took 26 minutes across 16 cores on a top-end machine (ie. several hours on one core). I guess I don't need to build LLVM(?)

https://old.reddit.com/r/ProgrammingLanguages/comments/hhxis...

Re:A Few More Reasons Rust Compiles Slowly by oldmanhorton on Monday June 29, 2020 @04:05PM (#23682042)
Chromium will easily take 5 or 6 hours for a clean build on a good professional workstation (i7/i9/low end xeon, 32-64GB RAM, nvme ssd).
Re:A Few More Reasons Rust Compiles Slowly by sgerenser on Tuesday June 30, 2020 @08:57AM (#23689525)
This guy did it in 53 minutes on a 16-core 3950x with a fast ssd: https://textslashplain.com/2020/02/02/my-new-chromium-build-...

Not fast by any means but big difference between 6 hours and 1.

Re:A Few More Reasons Rust Compiles Slowly by floatboth on Monday June 29, 2020 @09:24PM (#23685521)
How?!

I can build LLVM, Rust and Firefox in less time on my R7 1700.

How is Chromium so bloated??

Re:A Few More Reasons Rust Compiles Slowly by Bjartr on Tuesday June 30, 2020 @12:31AM (#23686585)
Is guess because Google devs have Google infrastructure to accelerate & paralellize builds in a distributed manner. Build time ends up being a pretty low priority to improve when the primary contributors to the project don't have a problem with it.
Re:A Few More Reasons Rust Compiles Slowly by secondcoming on Monday June 29, 2020 @02:36PM (#23680769)
It took my 4-core i4790K ~4 hours to compile tensorflow. Part of the build process builds LLVM...
Re:A Few More Reasons Rust Compiles Slowly by sangfroid_bio on Monday June 29, 2020 @02:26PM (#23680639)
Compilation speed comparable to template heavy C++, a large difference compared to Go for similarly sized projects
Re:A Few More Reasons Rust Compiles Slowly by rapsey on Monday June 29, 2020 @02:34PM (#23680746)
Chromium 5h+
Re:A Few More Reasons Rust Compiles Slowly by rurban on Monday June 29, 2020 @03:13PM (#23681321)
Like with Scala. Over 5 minutes for normal executable sizes.
Re:A Few More Reasons Rust Compiles Slowly by staticassertion on Monday June 29, 2020 @04:17PM (#23682230)
builds for my 10kLOC project, which is a workspace. These are the commands run from the root of the workspace. We could clean up some deps, we use quite a few crates, and we use a number of proc macros as well. In general I'd say we're fairly "worst case" for compile time.

cargo clean; cargo build; 4m20

Commenting out two lines of code in one of the services + cargo build; 0m14s

cargo clean; cargo build --release 11m43s

change 2 lines, cargo build --release 0m31s

I don't find this egregious.

ChromeOS Linux, which is debian

Intel i7 4 core 32GB RAM

Re:A Few More Reasons Rust Compiles Slowly by qppo on Monday June 29, 2020 @02:54PM (#23681049)
Pull in serde and run a non incremental release build