News for hackers. Stuff that matters.
Re:How to speed up the Rust compiler in August 2023 by stephc_int13 on Friday August 25, 2023 @08:02AM (#37260718)
A lot of us realized over the years that compilation time was a productivity killer.

The workflow can be adapted to slow compilation, obviously, with some discipline and a less iterative process.

But the ideal "flow" for many coders is attained with zero interruptions and being able to write-compile-test in a seamless fashion.

I think that the success of interpreters in many fields is related to this.

Modern compilers should maybe be split in two, a fast compile/slowish code/loose tests version and a "checks+release" one.

We have incredibly fast computers, instant compilation is feasible.

Re:How to speed up the Rust compiler in August 2023 by amenghra on Friday August 25, 2023 @08:28AM (#37260935)
We could do day-to-day Rust/C++/any compiled language related development with an interpreter/JIT and then compile the code once a PR is ready and the code hits CI/CD or gets deployed. The "instant" runtime doesn't even need to have the exact same behavior -- it can be 99% accurate and still be very useful.
Re:How to speed up the Rust compiler in August 2023 by rewmie on Friday August 25, 2023 @10:23AM (#37262068)
Why would anyone subject himself to that?

All mainstream build systems already support incremental builds, and in some cases it's even possible to leverage compiler cache to further shave down the time it takes to rebuild a project.

Breaking down a monolithic project into submodules is all it takes to shave off a big chunk of time from a build.

Re:How to speed up the Rust compiler in August 2023 by amenghra on Friday August 25, 2023 @11:22AM (#37262727)
Imagine being able to set a breakpoint in a function, change something and ask the debugger to “travel” back in time and pretend the code was always what it’s been changed to. It’s something some languages give you but I’m not sure an incremental compiler is sufficient?

These kinds of few seconds/minutes shaved add up and can impact one’s productivity.

Re:How to speed up the Rust compiler in August 2023 by tomjakubowski on Friday August 25, 2023 @11:50AM (#37263105)
for that kind of thing I would imagine more late binding in the language is helpful

at the level Rust works, late binding is hard to do but I don't think it's impossible. Name mangling and calling conventions are a couple big obstacles.

Re:How to speed up the Rust compiler in August 2023 by silverwind on Friday August 25, 2023 @08:31PM (#37268726)
> Modern compilers should maybe be split in two, a fast compile/slowish code/loose tests version and a "checks+release" one.

That's exactly what Vite is doing for JS. Nearly instantaneous dev build, and slow but thorough prod build which does all the expensive optimizations.

It seems odd that compiled languages have not picked this up yet.

Re:How to speed up the Rust compiler in August 2023 by paulddraper on Friday August 25, 2023 @11:54PM (#37269804)
TypeScript is a perfect example.

It can compile with typechecking, or, due to the design of the language, without any consideration of types at all.

This later mode is extremely fast, particularly with per file incrementality.

(Unfortunately for reasons I cannot fathom, this is not part of tsc CLI. You have to use something like Babel that uses the TS compiler API.)