-
Notifications
You must be signed in to change notification settings - Fork 13k
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
coverage: Simplify creation of sum counters #130263
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest taking an iterator instead of forcing a collect
. Unless you really need this to be a slice for some followup work. but even then, you could move the .iter().cloned()
to the caller.
I guess I should have read the description more carefully 🙈 don’t mind me then, as it looks like you will be needing a |
Yeah, creating the intermediate vector is deliberate, so that the two steps are clearly separate (and can be pulled further apart without additional hassle). |
And while I could make the helper take an iterator instead of a slice, I prefer the direct simplicity of the slice. It would be easy enough to change that back to taking an iterator if necessary, but I don't foresee that happening in the near future. |
Hmm, was rustbot asleep? r? compiler |
@bors r+ rollup |
coverage: Simplify creation of sum counters A small and self-contained improvement, extracted from some larger changes that I'm still working on. Ultimately I want to avoid creating these sum counter-expressions in some cases (in favour of just adding physical counters directly to the nodes we care about), so a good incremental move towards that is splitting the “gather edge counters” step out from the ”build a sum of those counters” step. Creating an extra intermediate vector should have negligible cost (and coverage isn't exercised by the benchmark suite anyway). The removed logging is redundant with the `#[instrument(..)]` logging we already have on the underlying method calls.
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#130101 (some const cleanup: remove unnecessary attributes, add const-hack indications) - rust-lang#130208 (Introduce `'ra` lifetime name.) - rust-lang#130263 (coverage: Simplify creation of sum counters) - rust-lang#130273 (more eagerly discard constraints on overflow) - rust-lang#130276 (Add test for nalgebra hang in coherence) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#130263 - Zalathar:sums, r=compiler-errors coverage: Simplify creation of sum counters A small and self-contained improvement, extracted from some larger changes that I'm still working on. Ultimately I want to avoid creating these sum counter-expressions in some cases (in favour of just adding physical counters directly to the nodes we care about), so a good incremental move towards that is splitting the “gather edge counters” step out from the ”build a sum of those counters” step. Creating an extra intermediate vector should have negligible cost (and coverage isn't exercised by the benchmark suite anyway). The removed logging is redundant with the `#[instrument(..)]` logging we already have on the underlying method calls.
A small and self-contained improvement, extracted from some larger changes that I'm still working on.
Ultimately I want to avoid creating these sum counter-expressions in some cases (in favour of just adding physical counters directly to the nodes we care about), so a good incremental move towards that is splitting the “gather edge counters” step out from the ”build a sum of those counters” step.
Creating an extra intermediate vector should have negligible cost (and coverage isn't exercised by the benchmark suite anyway). The removed logging is redundant with the
#[instrument(..)]
logging we already have on the underlying method calls.