Stream: general

Topic: librustc_mir incremental changes

RalfJ (Jul 24 2019 at 17:07, on Zulip):

Is it just me or did incremental changes to librustc_mir get a lot slower? I think it used to be on the order of 3-4min for a ./ build --keep-stage 0 src/rustc, now it's 5min just for the compiler artifacts and 7min in total. (also since when does the LLVM backend depend on rand? Are we generating random code now? :D )

oli (Jul 24 2019 at 17:13, on Zulip):

Hashing needs rand I guess

Wesley Wiser (Jul 24 2019 at 17:25, on Zulip):

I think the rand dependency is coming from cc which uses tempdir which uses rand. Seems innocuous enough.

RalfJ (Jul 24 2019 at 17:39, on Zulip):

yeah I also don't think rand is responsible for the slowdown

Jake Goulding (Jul 24 2019 at 19:43, on Zulip):


oli (Jul 24 2019 at 20:43, on Zulip):

const _: () = thread::sleep_ms(rand::random()) otherwise it won't affect compiletimes

nagisa (Jul 24 2019 at 20:52, on Zulip):

Except when its part of the compiler :D

Andreas Molzer (Jul 24 2019 at 20:58, on Zulip):

Something that seems like it could acutally be const at some point:
const _: MaybeUninit<[u8; 1 << (SystemTime::now() - UNIX_EPOCH).as_secs() % 30]> = MaybeUninit::zeroed()
Borrowing idea from Cs initial randomness, the __TIME__ macro.

oli (Jul 24 2019 at 21:00, on Zulip):

That is a very bad idea

oli (Jul 24 2019 at 21:03, on Zulip):

Especially considering that it would make a const fn return different values at each invocation

Andreas Molzer (Jul 24 2019 at 21:04, on Zulip):

Similar to __TIME__ I would expect the value to be some constant during compilation such as the start time.

oli (Jul 24 2019 at 21:04, on Zulip):

I'm fairly certain that combined with const prop you'd be able to cause UB or sth

oli (Jul 24 2019 at 21:04, on Zulip):

Different crates will see different values

oli (Jul 24 2019 at 21:07, on Zulip):

Also if you just want some constant, I propose const fn random() -> i32 { 4 /* chosen by fair dice roll */}

oli (Jul 24 2019 at 21:08, on Zulip):

I mean if you use include_bytes! on a /dev/foo you can already get random stuff at compile time and process that via const eval

oli (Jul 24 2019 at 21:09, on Zulip):

cc @centril

oli (Jul 24 2019 at 21:09, on Zulip):

Also, we should probably edit the topic

Last update: Nov 22 2019 at 00:05UTC