Uh oh!
There was an error while loading. Please reload this page.
Implement Chain with Option fuses - #70896
Conversation
The iterators are now "fused" with `Option` so we don't need separate state to track which part is already exhausted, and we may also get niche layout for `None`. We don't use the real `Fuse` adapter because its specialization for `FusedIterator` unconditionally descends into the iterator, and that could be expensive to keep revisiting stuff like nested chains. It also hurts compiler performance to add more iterator layers to `Chain`.
cuviper
commented
Apr 7, 2020
@bors try @rust-timer queue Locally, I measure this being a little faster than nightly on @KrishnaSannasi I went ahead and tried your folding idea for |
rust-timer
commented
Apr 7, 2020
Awaiting bors try build completion |
bors
commented
Apr 7, 2020
⌛ Trying commit 859b8da with merge 1f6bcab4a99b6f10ce766a1fe581010d3dd68f6a... |
bors
commented
Apr 7, 2020
☀️ Try build successful - checks-azure |
rust-timer
commented
Apr 7, 2020
Queued 1f6bcab4a99b6f10ce766a1fe581010d3dd68f6a with parent 42abbd8, future comparison URL. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rust-timer
commented
Apr 8, 2020
Finished benchmarking try commit 1f6bcab4a99b6f10ce766a1fe581010d3dd68f6a, comparison URL. |
cuviper
commented
Apr 8, 2020
@scottmcm I updated |
cuviper
commented
Apr 8, 2020
That perf report matches my own results -- better on We can also compare to #70332, with the caveat that they're not on the exact same merge base, but this PR looks a lot better. |
scottmcm
commented
Apr 9, 2020
@bors r+
I almost did 🙂 But then I thought about it more and worried that the |
bors
commented
Apr 9, 2020
📌 Commit ce8abc6 has been approved by |
Rollup of 7 pull requests Successful merges: - rust-lang#67705 (Use unrolled loop for searching NULL in [u16] on Windows) - rust-lang#70367 (save/restore `pessimistic_yield` when entering bodies) - rust-lang#70822 (Don't lint for self-recursion when the function can diverge) - rust-lang#70868 (rustc_codegen_ssa: Refactor construction of linker arguments) - rust-lang#70896 (Implement Chain with Option fuses) - rust-lang#70916 (Support `#[track_caller]` on functions in `extern "Rust" { ... }`) - rust-lang#70918 (rustc_session: forbid lints override regardless of position) Failed merges: r? @ghost
Changes[1] to the Rust standard library are affecting[2] the nesting size of types to the point where typed-html can not be built on nightly. This resolves the issue by increasing the acceptable recursion depth for the crate. [1]: rust-lang/rust#70896 [1]: rust-lang/rust#71359Closes: bodil#112
Changes[1] to the Rust standard library are affecting[2] the nesting size of types to the point where typed-html can not be built on nightly. This resolves the issue by increasing the acceptable recursion depth for the crate. [1]: rust-lang/rust#70896 [2]: rust-lang/rust#71359Closes: bodil#112
pnkfelix
commented
May 21, 2020
cuviper
commented
May 21, 2020
IMO that's niche enough to not worry about -- they were using a very long chain, but even that is now resolved by bodil/typed-html#117 (though not published yet). Plus, that project is already rife with increased Also, this PR had an incidental benefit on the very long compilation time in #70749 -- that code now compiles quickly with the |
The iterators are now "fused" with
Optionso we don't need separate state to track which part is already exhausted, and we may also get niche layout forNone. We don't use the realFuseadapter because its specialization forFusedIteratorunconditionally descends into the iterator, and that could be expensive to keep revisiting stuff like nested chains. It also hurts compiler performance to add more iterator layers toChain.This change was inspired by the proposal on the internals forum. This is an alternate to #70332, directly employing some of the same
Fuseoptimizations as #70366 and #70750.r? @scottmcm