4 ms·
Honest question as a java lover-- do rust and TS have slow compile times or something? Because java has a robust type system and yet I've never had any issue w
by galdosdi 2y ago
Honest question as a java lover-- do rust and TS have slow compile times or something?
Because java has a robust type system and yet I've never had any issue with it's compile times. And the parsing in the IDEs is so fast and good I can pretty much get all the feedback in real time.
Ah, that's the luxury of using a battle tested language that other people have invested billions of dollars of effort into optimizing.
Do you guys not have that in Rust and TS? Bummer man. Hope you get there someday. This is exactly why I abandoned scala btw.
- swsieber 2y agoYes - Rust has pretty slow compile times. It is perhaps my biggest gripe with it. You might define java as having a robust type system, but I would rate Rust's as significantly better. Several things in Rust I miss when working in Java: * Monomorphized types * Sum type and product types. Think sealed classes in java, but with better ergonomics * A really clever type system that prevents things like ConcurrentModificationException and data races (not dead-locks or race conditions generally though). Though, IIUC, Rust made early decisions about module structure that have really hindered compile speed, not necessarily tied to the type system. Another big factor that makes rust slow would be optimizations & slow system linkers; it doesn't have a JVM that can warm up to optimize stuff. Source: work with both Rust and Java on a daily basis. Edit: The way the type system works out in general makes me far less worried about making sweeping changes in a Rust codebase than in a Java codebase, but there are still logic bugs that I miss occasionally. Still, it moves quite a big bug finding from "run the program and see" to "make it pass typechecking", which is quite a bit faster than compiling; you can typecheck Rust without compiling it.
- roland35 2y agoI find using cargo watch really helps with my perceived compile times - it runs a check then build on every file save. By the time I open a new terminal to test things out it is ready to go!
- airstrike 2y agoIn my experience Rust still compiles as fast as I need it to (other than for the very first fresh compilation) and using language servers / rust-analyze I get literal instant feedback in vscode as I hit save. Not to mention autocomplete...
- marcosdumay 2y ago> Ah, that's the luxury of using a battle tested language that other people have invested billions of dollars of effort into optimizing. Making your compiler fast is easy when it doesn't do any work. The Go one seems to be even faster than Javac.
- galdosdi 2y agoPoint well taken, golang feels painful to use compared to java due to its weak type system (to be fair, I have NOT used it since generics were added, so I don't know if that helped a lot -- that was always my main pain point, it made collections kinda useless -- it's not a coincidence that java added generics (1.5) soon after it added collections (1.2)) Anyway, I'm not sure if this is a situation where the extra power of Rust's type system could not possibly be made more performant and it's just a natural tradeoff, or whether it's a thing where it's a matter of time before Rust (or some competitor) catches up and we can have it all