News for hackers. Stuff that matters.
Re:Rust – Faster compilation with the parallel front-end in ... by insanitybit on Friday November 10, 2023 @10:20AM (#38219928)
I don't agree. There are a lot of things on the table, performance-wise.

1. The compiler could ship binary artifacts, which would avoid all compilation of build scripts/ proc macros, and allow those to be compiled with performance optimizations enabled. This would be huge on its own.

2. Cranelift could potentially improve backend codegen compile times significantly as well.

3. Link times are still suboptimal, mold is promising here.

We can definitely still get significant wins out of the compiler.

Pretty sure compile times can get cut in half (or better) with those changes.

Re:Rust – Faster compilation with the parallel front-end in ... by mariusor on Friday November 10, 2023 @10:59AM (#38220455)
It would be great it people would pay Rui to make mold versions for Windows and Mac, which ideally would be required before making it a part of the official Rust tool chain.
Re:Rust – Faster compilation with the parallel front-end in ... by satvikpendem on Friday November 10, 2023 @11:28AM (#38220830)
He did monetization the wrong way around, IMO. Most CI is on Linux, but most developers are on Windows or macOS, so he should've capitalized on the Linux builds being paid while the local developer builds on Windows and macOS being free.
Re:Rust – Faster compilation with the parallel front-end in ... by mariusor on Friday November 10, 2023 @11:35AM (#38220920)
I doubt that anyone cares all that much about linking times in the CI. And even if someone does, it's probably an individual developer or team, ie, someone without decision power to pay for something as niche as a linker.

Also, mold was designed as an alternative to gold / lld, therefore it would require to be open-source and free on their main platform: linux.

Re:Rust – Faster compilation with the parallel front-end in ... by satvikpendem on Friday November 10, 2023 @11:39AM (#38220980)
Well, CI is where the costs are, and if the application is big enough, even a few percent reduction via faster linking times would equate to lower costs, while in contrast, developers won't really care or notice a few percent reduction on their local machine.

It's AGPL on Linux now, and they sell commercial licenses for companies that won't touch that license, and they were contemplating earlier making mold only available under a non-free source available license like BSL, so there's no "requirement" as such that it be free and open source, even on Linux.

Re:Rust – Faster compilation with the parallel front-end in ... by insanitybit on Friday November 10, 2023 @12:25PM (#38221647)
I care deeply about linking times on CI. It's very frustrating having your code all build and run tests locally just to wait a long time for it to pass all of the CI barriers. Plus, CI builds often go stale much faster, so you're looking at much longer build times without caches.
Re:Rust – Faster compilation with the parallel front-end in ... by mariusor on Friday November 10, 2023 @12:47PM (#38221974)
Sure, but you're not really contradicting me unless you're able to get your company to pay for faster tooling. And if you can, why haven't you already?
Re:Rust – Faster compilation with the parallel front-end in ... by satvikpendem on Saturday November 11, 2023 @02:12AM (#38228205)
Well, yes, that is the crux of this argument, that one can convince their employer to use mold. Otherwise, what is the point of using it? Desktop users by and large will not notice a small 3-5% improvement in compile times while those that pay for CI will.
Re:Rust – Faster compilation with the parallel front-end in ... by jylam on Friday November 10, 2023 @01:32PM (#38222615)
> Most CI is on Linux, but most developers are on Windows or macOS

Do you have any data on this ? Maybe that's industry dependent, but I hardly know any Windows (not even talking about macOS, that's almost nil) developers outside of video games and web dev. 100% of Rust devs I know use Linux, to keep on the subject.

Re:Rust – Faster compilation with the parallel front-end in ... by satvikpendem on Saturday November 11, 2023 @02:10AM (#38228200)
Data that most people don't use Linux as their day-to-day desktop OS for development? I suppose you can just look at desktop Linux statistics, which shows <5% usage. In my experience, most use macOS, or Windows via WSL2, which does use Linux but I am not sure if that is actually reflected in any desktop OS statistics.
Re:Rust – Faster compilation with the parallel front-end in ... by rayiner on Friday November 10, 2023 @11:02AM (#38220487)
Maybe, but even twice as fast would still make it a “slow compiling language” in comparison to a “fast compiling language” like Go or Pascal.

This is not a knock on Rust—I doubt it’s possible to do what Rust does—including zero overhead abstractions—in a fast compiling language. Go certainly pays a performance penalty with things like boxed generics.

Re:Rust – Faster compilation with the parallel front-end in ... by insanitybit on Friday November 10, 2023 @12:23PM (#38221614)
Twice as fast (or more) is just what I'm aware of in terms of "things that are possible to do today but aren't the default/ would take work to hack in". I don't even know what other options there are beyond that.

But sure, twice as fast isn't fast, it's just faster. My point is that we're not at the point of serious diminishing returns, there's tons of stuff left to do.

Re:Rust – Faster compilation with the parallel front-end in ... by estebank on Friday November 10, 2023 @12:45PM (#38221952)
If there was a magic pot of gold, it would be technically possible to precompile every crate version with every rustc version on every supported platform and distrivute those prebuilt rlibs to users through cargo. That would help with first compile times when using the standard tooling, and not just for proc-macros.
Re:Rust – Faster compilation with the parallel front-end in ... by adastra22 on Friday November 10, 2023 @02:11PM (#38223134)
Not with incremental compile times, which is what people are complaining about.
Re:Rust – Faster compilation with the parallel front-end in ... by estebank on Friday November 10, 2023 @03:32PM (#38224123)
Different people with different use cases have different complains. I haven't quantified but have certainly seen various complaints about both cases from different people.
Re:Rust – Faster compilation with the parallel front-end in ... by cxr on Friday November 10, 2023 @12:27PM (#38221684)
> This is not a knock on Rust

It is a knock on Rust. The circumstances of Rust's state of existence in 2023, as a language created in this millennium but not in the last decade, are an absurdity.

> I doubt it’s possible to do what Rust does—including zero overhead abstractions—in a fast compiling language

People packaging releases for software written in Rust and others who are passive consumers and finding themselves downloading the repo to compile from source for whatever reason (e.g. because the creators don't do binary releases themselves) don't need "Rust" (i.e. the official build toolchain) to do the things that active contributors (who want to be yelled at about borrow checker violations) need from it.

I'd call this oversight a massive lack of imagination on the part of TPTB behind Rust, but that would be wrong, because there is no need to imagine the differences between these use cases. They exist. An adequate toolchain for dealing with projects written in Rust—despite the deliberate decisions made during the design of the language that led to these problems—does not.

Re:Rust – Faster compilation with the parallel front-end in ... by insanitybit on Friday November 10, 2023 @01:01PM (#38222173)
> The circumstances of Rust's state of existence in 2023, as a language created in this millennium but not in the last decade, are absurd.

Sorry, could you be more vague?

Anyway, your post seems to be about packaging software? Or something? Confusing since that has nothing to do with the language...

Re:Rust – Faster compilation with the parallel front-end in ... by cxr on Friday November 10, 2023 @01:25PM (#38222536)
> Sorry, could you be more vague?

Yes, I can, since "2023", "this millennium", and "in the last decade" are all concrete, well-defined things that lead to basically no ambiguity.

Re:Rust – Faster compilation with the parallel front-end in ... by foldr on Friday November 10, 2023 @01:37PM (#38222690)
Go’s generics aren’t boxed. At least, not in the sense that Java’s are. For example, you can write generic functions that operate over slices of unboxed values.
Re:Rust – Faster compilation with the parallel front-end in ... by neonsunset on Friday November 10, 2023 @02:11PM (#38223131)
Still worse than true monomorphized generics in C# which too has fast compilation times (by nature of being JIT-compiled, but AOT target is still faster than Rust once you download dependencies).
Re:Rust – Faster compilation with the parallel front-end in ... by foldr on Saturday November 11, 2023 @11:02AM (#38231461)
Go’s implementation strategy for generics essentially is monomophirization plus obvious code size optimizations (e.g. don’t generate different code for different pointer types given that they all have the same underlying representation). Do you have specific scenario in mind where Go’s implementation strategy carries a significant performance penalty? I think possibly there are some misconceptions in this thread about how Go’s implementation actually works.
Re:Rust – Faster compilation with the parallel front-end in ... by hobofan on Friday November 10, 2023 @02:51PM (#38223641)
> 2. Cranelift could potentially improve backend codegen compile times significantly as well.

I've been told that the Cranelift team (at least for the time being) doesn't have the intention on focusing on the optimizer to a degree where it would be competitive with LLVM's optimizers (which would also be a huge effort). So if you want faster compile times you would have to take significant performance hits (which for a lot of code compiled in CI is not a trade-off that people are willing to take).

Re:Rust – Faster compilation with the parallel front-end in ... by estebank on Friday November 10, 2023 @03:28PM (#38224075)
Beyond specific optimization and implementation details of a compiler, the three variables of "compilation speed", "generated code optimization" and "language expressiveness" are fundamentally in tension. In order to move one axis you have to affect one or both of the other two.
Re:Rust – Faster compilation with the parallel front-end in ... by insanitybit on Friday November 10, 2023 @03:03PM (#38223795)
Yes, to be clear, Cranelift would be suitable for dev and test builds, you'd likely use llvm for release builds. So in your CI builds you'll almost certainly stick to llvm.

(1) and (3) are still very significant, fwiw.