-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
pass RUSTC_HOST_FLAGS
at once without the for loop
#132365
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
Was there any specific motivation for these changes? I'm like 99% sure that this does nothing to speed up rustc invocations (I don't think there's anything to optimize in the shims, tbh), and I don't think that introducing unsafe stuff is warranted here (same with the |
It doesn't make sense to parse a value thousands of times when it's constant throughout the entire bootstrap invocation. For the same reason, it makes more sense to use |
I think there are still cases we could consider improving, such as parsing values from the arguments by iterating over them for each value. |
What do you mean by "thousands of times"? The function is called exactly once per rustc/rustdoc invocation. Caching it in a static variable doesn't help with anything, because after rustc finishes executing, its process ends and the static variable is destroyed, along with everything else in the process. And the next rustc invocation just creates a new static variable. The same is for the inline annotations, the compiler sees the definition of the functions, and thus doesn't need the inline annotations. It can decide on its own whether to inline or not, and in fact inlining them might not be the best choice, perf. wise. The functions are not particularly small or called often, so the function call overhead is not important But in any case, it won't actually change anything, this is completely inert in regards of rustc performance. The time spent in the shim is inconsequential when compared to the actually invoked rustc, there's really no point in optimizing any of this. |
Yeah I missed that point, I was thinking that the cache lives as long as the main bootstrap process for a moment..
The aim is to reduce the wrapper overhead, not to improve rustc's overall performance. If something is called frequently, wouldn’t inlining it make it cheaper than invoking it as a separate function? Doesn’t that save some extra instructions? |
f9dd666
to
a8cbda5
Compare
Well, in theory, yes, but inlining doesn't always help performance. And maybe it was already inlined before. But what I wanted to say is that it doesn't really matter what we do in the shim. Even a |
I didn’t expect significant improvements here—it just made more sense to do (for instance, why iterate over a list when we can pass it directly?). If something can be done in a more sensible way, why not doing it? That's why it’s described as "better than nothing". I get your point and I already mentioned that "no significant improvement was achieved". Unless the change is harmful to the workflow, I don't see a problem with it. |
Yeah, the I still think that the So feel free to r=me once CI is green. |
Signed-off-by: onur-ozkan <work@onurozkan.dev>
a8cbda5
to
4b52bbc
Compare
RUSTC_HOST_FLAGS
at once without the for loop
I am fan of making super micro optimizations, but I don’t want to debate over something that doesn’t bring significant results. For that reason I reverted the inline change. |
@bors r=Kobzol |
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#132347 (Remove `ValueAnalysis` and `ValueAnalysisWrapper`.) - rust-lang#132365 (pass `RUSTC_HOST_FLAGS` at once without the for loop) - rust-lang#132366 (Do not enforce `~const` constness effects in typeck if `rustc_do_not_const_check`) - rust-lang#132376 (Annotate `input` reference tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132365 - onur-ozkan:less-rustc-overhead, r=Kobzol pass `RUSTC_HOST_FLAGS` at once without the for loop For obvious reasons...
For obvious reasons...