These are chat archives for rust-lang/rust

17th
Oct 2017
David Harvey-Macaulay
@alteous
Oct 17 2017 16:07
Can I embed images with rustdoc?
Steve Klabnik
@steveklabnik
Oct 17 2017 16:19
not really
you can host them somewhere and link to them
but there's no simple way to say "hey rustdoc please bundle all of this up"
David Harvey-Macaulay
@alteous
Oct 17 2017 16:20
@steveklabnik Thanks, noted.
Hopefully that will change in the future.
Steve Klabnik
@steveklabnik
Oct 17 2017 16:20
someday, possibly, yeah
David Harvey-Macaulay
@alteous
Oct 17 2017 17:34
When designing a crate, what is considered more idiomatic: one error type per module or one error type covering all possible errors from the crate?
I prefer the latter, personally, but I've received criticism for this strategy and wondered if it's worth redesigning to the former strategy.
Steve Klabnik
@steveklabnik
Oct 17 2017 17:44
i think it depends
i usually start with one error type for all possible errors
but if the grouping makes sense, splitting it up can too
i think it's also a function of size
my crates tend to be small and focused
Alyani
@notsonotso
Oct 17 2017 18:23
we're having terrible problems with compile times. We've tried all the known tricks with incremental (we're on latest)
any secret tricks we can do??
David Harvey-Macaulay
@alteous
Oct 17 2017 18:24
@notsonotso How large are your modules? It may be worth breaking up your project into several subcrates.
Alyani
@notsonotso
Oct 17 2017 18:25
none of our crates are big, and the overall app is moderate
the whole thing is about 50K lines
we're starting to regret picking Rust
Steve Klabnik
@steveklabnik
Oct 17 2017 18:38
how long are your times?
just curious
Alyani
@notsonotso
Oct 17 2017 18:45
@steveklabnik it's pretty bad, making code/compile/test roundtrips a sad task
easily 15-20 seconds
Steve Klabnik
@steveklabnik
Oct 17 2017 18:45
ah
yeah i wanted to know what "pretty bad" means to you, specifically
Alyani
@notsonotso
Oct 17 2017 18:45
i see :)
Steve Klabnik
@steveklabnik
Oct 17 2017 18:45
like, some people go "oh, this build is only ten minutes" and other people go "oh, this build is five seconds" and both can say "pretty bad" :)
it depends on what your frame of reference is
so, not saying it's not painful!
but always trying to collect data
David Harvey-Macaulay
@alteous
Oct 17 2017 18:46
It seems LLVM is the main bottleneck of rustc. It would be great if there was an alternative backend for debug builds.
Alyani
@notsonotso
Oct 17 2017 18:46
very painful IMO :(
Judson Lester
@nyarly
Oct 17 2017 18:47
I'm always curious: what's your frame of reference? What is a 15 second build slow as compared to?
Alyani
@notsonotso
Oct 17 2017 18:47
for a 50KLOC project, it's slow compared to everything, including C++
and this is a truly beefy machine, my co-worker is working on a laptop, and I think it's like 30 seconds
you spot the mistake, fixes the single line, and wanna try it out. When you're used, say, working in Java where Eclipse compiles as you save, it becomes painful :) Sure, the Rust compiler does a LOT more, but the dev experience isn't great.
Steve Klabnik
@steveklabnik
Oct 17 2017 18:50
as @alteous said, it's dominated by codgen
are you using cargo-check at all?
Alyani
@notsonotso
Oct 17 2017 18:50
would it be possible to do an LLM-JIT?
Steve Klabnik
@steveklabnik
Oct 17 2017 18:50
that's not going to be faster
Alex Crichton
@alexcrichton
Oct 17 2017 18:50
@notsonotso out of curiosity, is this publicly available code? We're always looking for new benchmarks to put on perf.rust-lang.org
Alyani
@notsonotso
Oct 17 2017 18:50
not even incremental JIT
?
TatriX
@TatriX
Oct 17 2017 18:50
golang, clean build for 32047 = 8.09s
Alyani
@notsonotso
Oct 17 2017 18:50
i mean, llvm's mcjit can do per-module jitting
@alexcrichton sorry, company code
Steve Klabnik
@steveklabnik
Oct 17 2017 18:51
did you see my cargo-check comment? i wonder what the time difference is for it vs build
Alex Crichton
@alexcrichton
Oct 17 2017 18:52
@notsonotso ah ok, no worries, and this is in debug mode, right? If so, have y'all played around with codegen units much?
James McCoy
@jamessan
Oct 17 2017 18:52
@notsonotso 15 seconds? I'd love my $work builds to be that fast. It's a minimum of a 1.5 minute build for a single line change
(for a c++ project)
Alyani
@notsonotso
Oct 17 2017 18:54
@jamessan that sounds like a bad design. I'm working on some very large Qt projects and most compiles are a couple of seconds.
of course, in that case it's a well thought-out design with lots of PIMPL tricks, etc
@steveklabnik i'll have to recheck, iirc not much of a difference
Steve Klabnik
@steveklabnik
Oct 17 2017 18:55
interesting
on most builds it should half the time
Alyani
@notsonotso
Oct 17 2017 18:55
(not at work right now... i'll check tomorrow)
Steve Klabnik
@steveklabnik
Oct 17 2017 18:55
checking with -Z time-passes to see if anything sticks out is also worthwhile
Alyani
@notsonotso
Oct 17 2017 18:56
will do
LLVM isn't what it used to be... at some point it got bloated and not-as-fast-as-advertised
i like mcjit though
James McCoy
@jamessan
Oct 17 2017 19:00
@notsonotso well, it's a multi-million LOC project with ~75 components major components and various modules within each of those. A full, clean rebuild takes ~2 hours. A lot of the overhead for the incremental build is build environment setup. At any rate, perspective is key :)
Alyani
@notsonotso
Oct 17 2017 19:01
@jamessan i assume in this case, a substantial time is spent linking
?
James McCoy
@jamessan
Oct 17 2017 19:32
a lot of it (for the part that I work on) is checking what needs to be rebuilt and setting up the build chroot, since that part of the project has a home-grown build system. A lot of the other parts use CMake