10 ms·
Oh please, it's plenty fast, at least on par with javac. There's also 'cargo check' which is blazing fast. If you're seeing very large compile time then it's a
by vvanders 9y ago
Oh please, it's plenty fast, at least on par with javac. There's also 'cargo check' which is blazing fast.
If you're seeing very large compile time then it's a good sign that you probably want to break things into smaller crates anyway. I've been working on some pretty large stuff and compile speeds haven't been an issue(aside from the Emscripten linker, but that's not Rust's fault).
- steveklabnik 9y ago"rustc is too slow" is possibly our most commonly-heard feedback. I am glad that you don't find it onerous, but many still do.
- bluejekyll 9y agoI don't know... I really think it depends on the audience you're catering to. As someone who only ever deals with compiled languages, this has never seemed to be a problem. Now, viewing this as someone coming from Python, Ruby, Node, etc., I can see compilation as being annoying. Is it really the only reason that they are disliking the language or is that just a strawman? I wonder if too much attention is being paid to this. Now there are legitimate things we can focus on, such as making cached precompiled libraries very easy to use. This can especially be important in CI environments... This would also generally make most compilations fast.
- steveklabnik 9y ago> such as making cached precompiled libraries very easy to use. This is already true today; that is, this cost is only paid the first time you compile. It's still not fast enough for people. On my machine, a fresh build of rustc takes an hour, and small changes take 20 minutes, and even that makes it a giant pain. It's an ergonomic thing, IMO.
- kibwen 9y ago> a fresh build of rustc takes an hour A bit influenced by the fact that rustc has to compile itself three times. :P
- steveklabnik 9y agoSure, but as with all end-user stuff, I don't care what it has to do, just that it has to do it.
- bluejekyll 9y agoI should have been more clear; I mean a solution for many devs to pull precompiled caches, and share those for the same version of libraries... this would also benefit CI, as all CI runs to be based off this.
- pjmlp 9y agoTurbo Pascal 5.5 was compiling 34,000 lines/minute. https://edn.embarcadero.com/article/20803 https://edn.embarcadero.com/article/20803 And even today Delphi 10 is quite fast. Same applies to many other compiled languages with modules.
- bluejekyll 9y agoI haven't worked with Pascal since 1999, I remember it being a much simpler language. And no where near as fun. Hilarity ensued when I didn't realize there was no garbage collector.
- pjmlp 9y agoPascal and Turbo Pascal aren't the same thing. Turbo Pascal was more a kind of simplified Ada than a pure Pascal, which made me look down on C when checking down the laundry list of language features of Turbo Pascal 6.0 versus ANSI C89 in 1993. Also by 1999 no one was doing anything serious in Turbo Pascal with the last version being targeted at Windows 3.1. Delphi 1.0 was released for Windows 95, and it did at least have some kind of GC for COM based classes. Also Delphi 10 might not have every Rust feature, but it surely has it own set of complex language features. Or if you prefer Ada, C#, D are also possible sources of information regarding performance of compilation toolchains, with relatively complex languages.
- WatchDog 9y agoIs it as fast as javac? Maybe on a line of code basis, but I imagine java is much simpler to to implement incremental compilation with. Since sources map pretty much 1 to 1 with classes, you mostly only need to recompile the class that changed.
- swsieber 9y agoUnfortunately, it's not quite that easy since java inlines constants, plus you have to account for package protected, inherited methods, etc. that you don't have to implicitly import. But really, it's the constants that make incremental compilation slower...
- hyperpape 9y agoIs this based on benchmarks? I don't have any, but I can do a clean compile of 8000 java classes (> 2 million lines) in 3 minutes on my underpowered Mac mini. I wouldn't expect Rust would ever be as fast to compile, even if it weren't a younger language, because Rust is doing compile time optimization that Java defers until runtime. And that's ok: there may be times what Java does is better, but there are also times it's worse.
- vvanders 9y agoMostly gut feeling :). To be fair my javac comparison with with Gradle + Android Studio layered on top so it may be a bit slanted in favor of Cargo/Rust. That said I've never seen a Java build environment that I'd call 'snappy'.
- fnord123 9y agoMaven takes a long long time to start up, but once it's ready, javac is pretty quick. Some Rust projects are very quick to build; but some are astonishingly slow to build. e.g. lalrpop is unusably slow (~15mins to build on 2014 Macbook Air). I think the place here performance breaks down is liberal use of generic types in functions. e.g. AsPath<T> and AsRef<T>, etc.) where the compiler creates the function for all the different types and then tries to collapse them again later on. So one rules of thumb is to only use those in the public APIs and convert the type so it can be passed around without generics internally within a module. Or maybe that's just me trying to do some `cargo cult` heuristics (haha! puns!)
- wtetzner 9y ago> Or maybe that's just me trying to do some `cargo cult` heuristics (haha! puns!) I always thought `cargo new` should have been called `cargo cult`.
- pjmlp 9y agoSo better try again with straight javac, Ant and Maven. Gradle sucks big time, why do you think Google still does talks letting angry Android developers that Gradle + Android Studio will some day be as fast as Ant + Eclipse? http://androidbackstage.blogspot.de/2017/04/episode-64-gradleweiss.html http://androidbackstage.blogspot.de/2017/04/episode-64-gradl... https://www.youtube.com/watch?v=BKRK4SvMtRk https://www.youtube.com/watch?v=BKRK4SvMtRk The Android Gradle plugin being slow as molasses is a typical discussion theme at Google IO since it was introduced. Being partially written in Groovy also doesn't help.
- amorphid 9y agoWhen you compile Java from the command line, is the compiler smart enough to not recompile files that haven't changed? Or is that an IDE feature?
- cytzol 9y agojavac itself doesn't do any incremental compilation and will happily compile over your .class each time (though you can tell it not to; see http://stackoverflow.com/q/8271282 http://stackoverflow.com/q/8271282) Build tools like Maven and Gradle, as well as IDEs' internal build tools, will be smart and compile only the changed files.
- pjmlp 9y agoI wish it would be on par with javac, but my experience compiling rustfmt, rustsym and racer tells me otherwise. Also a bit disappointed when compared with other languages that support modules, specially the ones whose toolchains support binary dependencies. Not everyone has a high end development workstation. I am however confident the experience will eventually improve.