Put InhabitedPredicate::NotInModule earlier in disjunction since it can be a lot faster#158819
Conversation
|
r? @khyperia rustbot has assigned @khyperia. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Put `InhabitedPredicate::NotInModule` earlier in disjunction since it can be a lot faster
|
In fact, for the crate in #141006 the really problematic/long parts seem to be completely gone like this: (the upper graph is with this PR; I have roughly marked corresponding sections AFAICT, and resized the windows to match time scales)
|
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (f0c1ec5): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 0.6%, secondary 2.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 489.956s -> 490.266s (0.06%) |
|
I’m no expert on interpreting these results, but it looks like it doesn’t do any harm.1 So I guess we should land this change? Is there any practice of creating new benchmarks (or tests?) for cases like this, to prevent regressions in the code pattern that is better supported now? If so, where would that go? (If that’s a desirable thing, I’d then work a bit on trying to minimize the reproducing crate/example into something more standalone that can still demonstrate the speedup.) Footnotes
|
|
neat, this seems fine to merge, why not I suppose! let me know if you're happy with this as-is.
I don't know the context of adding benchmarks here, but it does seem nice to try to track this a bit better. From what you said in the issue
this change might make it more difficult to find/track things, since we can't use the real-world crates out of the box anymore, since the underlying issue is "solved" by this, so we'll need some sort of repro that's all |
|
I agree, those steps can make sense as a follow up. From my POV, this could be merged as-is. |
|
@bors r+ |
Yes. This is a candidate for secondary stress test. If you could isolate a small program that reproduces the issue and shows the 7-8x improvement, we could add it. This seems subtle enough that I think it's worth adding, but maybe others from the wg have a different opinion. In any case, while we still don't have a test/benchmark elsewhere, I'd at least add a comment that the ordering choice is important. |
Rollup of 24 pull requests Successful merges: - #158377 (add `-Zforce-intrinsic-fallback` flag) - #158642 (Clarify some interning details) - #158694 (Positive test for closures needing expectations) - #158743 (Look for cdb location in the registry first) - #158775 (bootstrap: only encode RUSTFLAGS when a flag contains a space) - #158782 (Add and use cfg(target_has_threads) to enforce no_thread impl usage) - #158785 (hook intrinsic-test into aarch64-gnu) - #158819 (Put `InhabitedPredicate::NotInModule` earlier in disjunction since it can be a lot faster) - #157734 (Stabilize `local_key_cell_update`) - #158183 (std: allocate less memory in `current_exe` for OpenBSD) - #158310 (Remove unexpected usage of Unambig in non-infer variants) - #158671 (Move tests batch 17) - #158730 (Update `FIXME(static_mut_refs)` comments) - #158752 (Reorganize `tests/ui/issues` [18/N]) - #158755 (Use `ThinVec` more in the AST) - #158757 (Fix incorrect tracking issue for `read_le`/`read_be`) - #158765 (Fix ICE on non-ident path in `doc(auto_cfg values)`) - #158771 (library: expand HashSet::extract_if coverage) - #158772 (rustc-dev-guide subtree update) - #158776 (fix: emit diagnostic for AVR target without target-cpu) - #158786 (Add regression test for builtin attr macro values) - #158810 (Add supplementary information for get_unchecked(mut)) - #158825 (Fix typo) - #158838 (tidy: Use `empty_alternate = true` for triagebot mention glob check)
Rollup of 24 pull requests Successful merges: - #158377 (add `-Zforce-intrinsic-fallback` flag) - #158642 (Clarify some interning details) - #158694 (Positive test for closures needing expectations) - #158743 (Look for cdb location in the registry first) - #158775 (bootstrap: only encode RUSTFLAGS when a flag contains a space) - #158782 (Add and use cfg(target_has_threads) to enforce no_thread impl usage) - #158785 (hook intrinsic-test into aarch64-gnu) - #158819 (Put `InhabitedPredicate::NotInModule` earlier in disjunction since it can be a lot faster) - #157734 (Stabilize `local_key_cell_update`) - #158183 (std: allocate less memory in `current_exe` for OpenBSD) - #158310 (Remove unexpected usage of Unambig in non-infer variants) - #158671 (Move tests batch 17) - #158730 (Update `FIXME(static_mut_refs)` comments) - #158752 (Reorganize `tests/ui/issues` [18/N]) - #158755 (Use `ThinVec` more in the AST) - #158757 (Fix incorrect tracking issue for `read_le`/`read_be`) - #158765 (Fix ICE on non-ident path in `doc(auto_cfg values)`) - #158771 (library: expand HashSet::extract_if coverage) - #158772 (rustc-dev-guide subtree update) - #158776 (fix: emit diagnostic for AVR target without target-cpu) - #158786 (Add regression test for builtin attr macro values) - #158810 (Add supplementary information for get_unchecked(mut)) - #158825 (Fix typo) - #158838 (tidy: Use `empty_alternate = true` for triagebot mention glob check)
Rollup of 24 pull requests Successful merges: - #158377 (add `-Zforce-intrinsic-fallback` flag) - #158642 (Clarify some interning details) - #158694 (Positive test for closures needing expectations) - #158743 (Look for cdb location in the registry first) - #158775 (bootstrap: only encode RUSTFLAGS when a flag contains a space) - #158782 (Add and use cfg(target_has_threads) to enforce no_thread impl usage) - #158785 (hook intrinsic-test into aarch64-gnu) - #158819 (Put `InhabitedPredicate::NotInModule` earlier in disjunction since it can be a lot faster) - #157734 (Stabilize `local_key_cell_update`) - #158183 (std: allocate less memory in `current_exe` for OpenBSD) - #158310 (Remove unexpected usage of Unambig in non-infer variants) - #158671 (Move tests batch 17) - #158730 (Update `FIXME(static_mut_refs)` comments) - #158752 (Reorganize `tests/ui/issues` [18/N]) - #158755 (Use `ThinVec` more in the AST) - #158757 (Fix incorrect tracking issue for `read_le`/`read_be`) - #158765 (Fix ICE on non-ident path in `doc(auto_cfg values)`) - #158771 (library: expand HashSet::extract_if coverage) - #158772 (rustc-dev-guide subtree update) - #158776 (fix: emit diagnostic for AVR target without target-cpu) - #158786 (Add regression test for builtin attr macro values) - #158810 (Add supplementary information for get_unchecked(mut)) - #158825 (Fix typo) - #158838 (tidy: Use `empty_alternate = true` for triagebot mention glob check)
Rollup merge of #158819 - steffahn:uninhab-module-check-first, r=khyperia Put `InhabitedPredicate::NotInModule` earlier in disjunction since it can be a lot faster In my local testing, a simple reordering here can help *a lot* already in the regression reported in #141006, speeding up compilation roughly 7-8x, so I'd like to find out if this has any performance downsides.
Thank you for the pointer. Now I’ve just got to produce a reproducing example in the first place 😇
Sounds reasonable, I’ll include that in a follow-up ^^ |
Rollup of 24 pull requests Successful merges: - rust-lang/rust#158377 (add `-Zforce-intrinsic-fallback` flag) - rust-lang/rust#158642 (Clarify some interning details) - rust-lang/rust#158694 (Positive test for closures needing expectations) - rust-lang/rust#158743 (Look for cdb location in the registry first) - rust-lang/rust#158775 (bootstrap: only encode RUSTFLAGS when a flag contains a space) - rust-lang/rust#158782 (Add and use cfg(target_has_threads) to enforce no_thread impl usage) - rust-lang/rust#158785 (hook intrinsic-test into aarch64-gnu) - rust-lang/rust#158819 (Put `InhabitedPredicate::NotInModule` earlier in disjunction since it can be a lot faster) - rust-lang/rust#157734 (Stabilize `local_key_cell_update`) - rust-lang/rust#158183 (std: allocate less memory in `current_exe` for OpenBSD) - rust-lang/rust#158310 (Remove unexpected usage of Unambig in non-infer variants) - rust-lang/rust#158671 (Move tests batch 17) - rust-lang/rust#158730 (Update `FIXME(static_mut_refs)` comments) - rust-lang/rust#158752 (Reorganize `tests/ui/issues` [18/N]) - rust-lang/rust#158755 (Use `ThinVec` more in the AST) - rust-lang/rust#158757 (Fix incorrect tracking issue for `read_le`/`read_be`) - rust-lang/rust#158765 (Fix ICE on non-ident path in `doc(auto_cfg values)`) - rust-lang/rust#158771 (library: expand HashSet::extract_if coverage) - rust-lang/rust#158772 (rustc-dev-guide subtree update) - rust-lang/rust#158776 (fix: emit diagnostic for AVR target without target-cpu) - rust-lang/rust#158786 (Add regression test for builtin attr macro values) - rust-lang/rust#158810 (Add supplementary information for get_unchecked(mut)) - rust-lang/rust#158825 (Fix typo) - rust-lang/rust#158838 (tidy: Use `empty_alternate = true` for triagebot mention glob check)

In my local testing, a simple reordering here can help a lot already in the regression reported in #141006, speeding up compilation roughly 7-8x, so I'd like to find out if this has any performance downsides.