-
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
rustdoc-search: depth limit T<U>
-> U
unboxing
#122247
rustdoc-search: depth limit T<U>
-> U
unboxing
#122247
Conversation
Profiler output: https://notriddle.com/rustdoc-html-demo-9/search-unbox-limit/ This is a performance enhancement aimed at a problem I found while using type-driven search on the Rust compiler. It is caused by [`Interner`], a trait with 41 associated types, many of which recurse back to `Self` again. This caused search.js to struggle. It eventually terminates, after about 10 minutes of turning my PC into a space header, but it's doing `41!` unifications and that's too slow. [`Interner`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/trait.Interner.html
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha |
This is a great improvement, thanks! Could you add a |
Sure, the second commit now adds that.
I can't find any way to make compiletest do that, or precedent in other parts of the compiler to use it that way. Am I missing something? |
I don't think we have a way to do this currently. I had in mind to add a timer for each search JS test we run and once we reach the limit, to kill the test execution. If you want I can take a look in a follow-up PR? If so r=me |
I don't think using setTimeout in Node will work, because the search will block the event loop and prevent the timer from actually firing. Doing it in a follow-up PR sounds like a good idea. This discussion should involve the compiletest maintainers. |
I had something else in mind in fact with |
That still sounds like you're thinking of implementing the timeout in Node. Since search.js doesn't explicitly yield to the event loop (and, even if it did, we wouldn't want to rely on it for this kind of testing), the timer's callback won't be able to dispatch until the search is done. |
You're right, we might need to use threads or subprocesses for that. But yes, I think it'd be better to have it done with node directly. |
I'll add the test timeout in a follow-up. Thanks for this fix! @bors r+ rollup |
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#119029 (Avoid closing invalid handles) - rust-lang#122238 (Document some builtin impls in the next solver) - rust-lang#122247 (rustdoc-search: depth limit `T<U>` -> `U` unboxing) - rust-lang#122287 (add test ensuring simd codegen checks don't run when a static assertion failed) - rust-lang#122368 (chore: remove repetitive words) - rust-lang#122397 (Various cleanups around the const eval query providers) - rust-lang#122406 (Fix WF for `AsyncFnKindHelper` in new trait solver) - rust-lang#122477 (Change some attribute to only_local) - rust-lang#122482 (Ungate the `UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES` lint) - rust-lang#122490 (Update build instructions for OpenHarmony) Failed merges: - rust-lang#122471 (preserve span when evaluating mir::ConstOperand) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122247 - notriddle:notriddle/search-unbox-limit, r=GuillaumeGomez rustdoc-search: depth limit `T<U>` -> `U` unboxing Profiler output: https://notriddle.com/rustdoc-html-demo-9/search-unbox-limit/ (the only significant change is that one of the `rust` tests went from 378416ms to 16ms). This is a performance enhancement aimed at a problem I found while using type-driven search on the Rust compiler. It is caused by [`Interner`], a trait with 41 associated types, many of which recurse back to `Self` again. This caused search.js to struggle. It eventually terminates, after about 10 minutes of turning my PC into a space header, but it's doing `41!` unifications and that's too slow. [`Interner`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/trait.Interner.html
Profiler output:
https://notriddle.com/rustdoc-html-demo-9/search-unbox-limit/ (the only significant change is that one of the
rust
tests went from 378416ms to 16ms).This is a performance enhancement aimed at a problem I found while using type-driven search on the Rust compiler. It is caused by
Interner
, a trait with 41 associated types, many of which recurse back toSelf
again.This caused search.js to struggle. It eventually terminates, after about 10 minutes of turning my PC into a space header, but it's doing
41!
unifications and that's too slow.