thom
shift.click
thom
@shift.click
rust stdlib maintainer (library team member) | watches a lot of anime | on twitter as at_tcsc, and hachyderm as zuurr | bi | they/he
I would try doc.rust-lang.org/nightly/std/... rather than boxing to avoid the box overhead. That said, I'm at work at the moment so I can't really investigate. 1000 chains in a row is certainly a degenerate case and there's a number of reasons that could perform poorly, just not for the cited reason
Iterator in std::iter - Rust
A trait for dealing with iterators.
doc.rust-lang.org
October 20, 2025 at 2:53 PM
Sum uses fold: doc.rust-lang.org/nightly/src/..., which as linked in my other comment does this. If you're seeing rust being slower than the other languages here, it's more likely because of copying around the iterator object, which will be considerably larger in Rust. A profile might be useful.
accum.rs - source
Source of the Rust file `library/core/src/iter/traits/accum.rs`.
doc.rust-lang.org
October 20, 2025 at 2:44 PM
default impl doesn't call next in a loop. It calls fold: doc.rust-lang.org/nightly/src/.... In the case of Chain, that has a custom impl that calls all the first iterator and then all the second iterator: doc.rust-lang.org/nightly/src/.... which avoids the issue (intentionally).
iterator.rs - source
Source of the Rust file `library/core/src/iter/traits/iterator.rs`.
doc.rust-lang.org
October 20, 2025 at 2:37 PM
yeah my interest in semiprofessional tech things is at an all time low honestly >_>

i also like the aspect of twitter where people follow me for tech stuff and then i almost never tweet about tech, which this lacks... for now
July 2, 2023 at 2:40 AM
i still had this tab open i guess. the thing i love the most about it is how people rationalize software bugs in their heads. like, parallel universe is certainly a way you can explain that particular bug...

you see this kid of stuff with lots of speedrunning, and i love it every time.
June 29, 2023 at 7:58 AM
its so good
June 28, 2023 at 9:27 PM
Map keys dont, Object does though, although theres some specialness with array. I guess you mean JSON tho
May 15, 2023 at 8:21 PM
(actually in reality, i would probably be very stressed out by the whole thing and dissappear from the public eye to handle it, but still)
May 11, 2023 at 4:48 PM
narrator: it does
May 10, 2023 at 10:00 PM
admittedly "hard to prove correct" is probably what i signed up for when I typed `use core::intrinsics::{atomic_load_unordered, assume};`
May 6, 2023 at 8:17 PM