Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling "Hello World" can take a prohibitive amount of time #3216

Closed
bstrie opened this issue Aug 17, 2012 · 8 comments
Closed

Compiling "Hello World" can take a prohibitive amount of time #3216

bstrie opened this issue Aug 17, 2012 · 8 comments
Labels
A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@bstrie
Copy link
Contributor

bstrie commented Aug 17, 2012

I've noticed recently that the compilation times of even trivial programs has become relatively large. This is most noticeable in the context of my sort-of-REPL, which now exhibits noticeable pauses between entering commands due to constant recompiles. On my beefy desktop, compiling the standard HW:

fn main() {
    io::println("hello, world!");
}

takes around 0.4 seconds. I've spoken with @pcwalton briefly about this and he's acknowledged the issue and mentioned that he has ideas to mitigate it.

Here's a more severe case: a fellow on IRC (MattCoder) has noted that on a Windows XP virtual machine, Hello World takes more than a minute to compile. The machine is an Intel Core 2 Quad CPU Q8400 @ 2.66Ghz with 4GB RAM, and the virtual machine itself has 2GB. It should also be noted that the virtual machine runs VS2008 comfortably and compiles C and C# programs in the negligible time you would expect: http://postimage.org/image/o9y6d1znl/

@ghost ghost assigned graydon Aug 17, 2012
@graydon
Copy link
Contributor

graydon commented Aug 17, 2012

Yeah. This is something we need to spend some time on before 0.4; it's sufficiently bad that we're seeing people landing a lot of code (myself included) without completing a full testsuite run. Because it takes too long. That's not cool.

(Not to say that the various improvements in the compiler that have cost it performance were bad ideas! Just that it seems like there's some cost to mop up)

@bblum
Copy link
Contributor

bblum commented Aug 17, 2012

oh, wow, i thought the increased times to build libcore and libstd were my fault for adding so much code to them.

fwiw, last time i ran -Z time-passes building one of these i remember LLVM being slower than any other pass by a factor of 20 or so.

@graydon
Copy link
Contributor

graydon commented Mar 20, 2013

non-critical for 0.6, de-milestoning

@pcwalton
Copy link
Contributor

pcwalton commented May 9, 2013

Yes, there is still too much metadata reading.

@alexcrichton
Copy link
Member

Today, this takes ~250ms to compile. The worst offenders are:

time: 0.064 s   external crate/lib resolution
time: 0.056 s   resolution
time: 0.046 s   coherence checking
time: 0.021 s   linking

Note that this is also an incredible pain point for rusti. Currently rusti feeds input 3 times to the compiler per line of input, so it's very very slow as a result of this. While rusti has its own class of performance issues, speeding this up would certainly help speeding that up.

Nominating for production-ready

@graydon
Copy link
Contributor

graydon commented Jul 18, 2013

accepted for production-ready milestone

@pcwalton
Copy link
Contributor

This is each_path badness. Those 3 passes are the ones that call each_path. We need to remove all uses of it.

@graydon
Copy link
Contributor

graydon commented Aug 20, 2013

Dupe of #4572

@graydon graydon closed this as completed Aug 20, 2013
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
Update bytecount to 0.4, and use its generic feature.

Closes rust-lang#3216.
RalfJung pushed a commit to RalfJung/rust that referenced this issue Dec 17, 2023
Fix x86 SSE4.1 ptestnzc

Fixes ptestnzc by bringing back the original implementation of rust-lang/miri#3214.

`(op & mask) != 0 && (op & mask) == !ask` need to be calculated for the whole vector. It cannot be calculated for each element and then folded.

For example, given
* `op = [0b100, 0b010]`
* `mask = [0b100, 0b110]`

The correct result would be:
* `op & mask = [0b100, 0b010]`
Comparisons are done on the vector as a whole:
* `all_zero = (op & mask) == [0, 0] = false`
* `masked_set = (op & mask) == mask = false`
* `!all_zero && !masked_set = true` correct result

The previous method:
* `op & mask = [0b100, 0b010]`
Comparisons are done element-wise:
* `all_zero = (op & mask) == [0, 0] = [true, true]`
* `masked_set = (op & mask) == mask = [true, false]`
* `!all_zero && !masked_set = [true, false]`
 After folding with AND, the final result would be `false`, which is incorrect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

5 participants