Skip to content
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

Add #[track_caller] to panicking Vec functions #83359

Closed
wants to merge 5 commits into from

Conversation

Dylan-DPC-zz
Copy link

Rework of #79323

cc @nvzqz

r? @joshtriplett

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 22, 2021
@rust-log-analyzer

This comment has been minimized.

@Dylan-DPC-zz
Copy link
Author

@bors try

@bors
Copy link
Contributor

bors commented Mar 22, 2021

⌛ Trying commit af60851 with merge 29b6a20637e5eac3c6da17e198fdbb0905e70db5...

@bors
Copy link
Contributor

bors commented Mar 22, 2021

☀️ Try build successful - checks-actions
Build commit: 29b6a20637e5eac3c6da17e198fdbb0905e70db5 (29b6a20637e5eac3c6da17e198fdbb0905e70db5)

@nagisa
Copy link
Member

nagisa commented Mar 22, 2021

This definitely needs a performance evaluation, in both microbenchmark and real use-case scenarios. #[track_caller] may be cheap, but its probably not as free as one would like.

@Dylan-DPC-zz
Copy link
Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 22, 2021
@bors
Copy link
Contributor

bors commented Mar 22, 2021

⌛ Trying commit af60851 with merge 4419c96369613ee87683c99b73992ab49319a5f7...

@bors
Copy link
Contributor

bors commented Mar 22, 2021

☀️ Try build successful - checks-actions
Build commit: 4419c96369613ee87683c99b73992ab49319a5f7 (4419c96369613ee87683c99b73992ab49319a5f7)

@rust-timer
Copy link
Collaborator

Queued 4419c96369613ee87683c99b73992ab49319a5f7 with parent 2287a88, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (4419c96369613ee87683c99b73992ab49319a5f7): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 22, 2021
@joshtriplett
Copy link
Member

There's a minor performance hit by timing metrics, but the hit on memory (max-rss) seems more excessive.

@@ -2792,7 +2807,7 @@ impl<T, A: Allocator, const N: usize> TryFrom<Vec<T, A>> for [T; N] {
/// # Examples
///
/// ```
/// use std::convert::TryInto;
/// use std::convert::TryInto;k
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unintentional.

@joshtriplett
Copy link
Member

Following up on this: I've since learned that the max-rss statistics aren't necessarily reliable enough to know if the observed increase in memory here is real or spurious. The performance numbers seem reasonable given the benefit, so I think it's reasonable for this change to go ahead (modulo the typo fix already noted).

@Dylan-DPC-zz
Copy link
Author

@joshtriplett once i fix the typo, can i r= you?

@joshtriplett
Copy link
Member

@Dylan-DPC Yes, go ahead.

@Dylan-DPC-zz
Copy link
Author

created #83909 because i did this on the wrong remote :D

@Dylan-DPC-zz Dylan-DPC-zz deleted the min/add-track-caller branch April 6, 2021 12:06
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 16, 2024
Add `#[track_caller]` to allocating methods of `Vec` & `VecDeque`

Part 4 in a lengthy saga.
r? `@joshtriplett` because they were the reviewer the last 3 times.
`@bors` rollup=never "[just in case this has perf effects, Vec is hot](rust-lang#79323 (comment))"

This was first attempted in rust-lang#79323 by `@nvzqz.` It got approval from `@joshtriplett,` but rotted with merge conflicts and got closed.

Then it got picked up by `@Dylan-DPC-zz` in rust-lang#83359. A benchmark was run[^perf], the results (after a bit of thinking[^thinking]) were deemed ok[^ok], but there was a typo[^typo] and the PR was made from a wrong remote in the first place[^remote], so rust-lang#83909 was opened instead.

By the time rust-lang#83909 rolled around, the methods in question had received some optimizations[^optimizations], so another perf run was conducted[^perf2]. The results were ok[^ok2]. There was a suggestion to add regression tests for panic behavior [^tests], but before it could be addressed, the PR fell victim to merge conflicts[^conflicts] and died again[^rip].

3 years have passed, and (from what I can tell) this has not been tried again, so here I am now, reviving this old effort.

Given how much time has passed and the fact that I've also touched `VecDeque` this time, it probably makes sense to
`@bors` try `@rust-timer`

[^perf]: rust-lang#83359 (comment)
[^thinking]: rust-lang#83359 (comment)
[^ok]: rust-lang#83359 (comment)
[^typo]: rust-lang#83359 (comment)
[^remote]: rust-lang#83359 (comment)
[^optimizations]: rust-lang#83909 (comment)
[^perf2]: rust-lang#83909 (comment)
[^ok2]: rust-lang#83909 (comment)
[^tests]: rust-lang#83909 (comment)
[^conflicts]: rust-lang#83909 (comment)
[^rip]: rust-lang#83909 (comment)
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 21, 2024
Add `#[track_caller]` to allocating methods of `Vec` & `VecDeque`

Part 4 in a lengthy saga.
r? `@joshtriplett` because they were the reviewer the last 3 times.
`@bors` rollup=never "[just in case this has perf effects, Vec is hot](rust-lang#79323 (comment))"

This was first attempted in rust-lang#79323 by `@nvzqz.` It got approval from `@joshtriplett,` but rotted with merge conflicts and got closed.

Then it got picked up by `@Dylan-DPC-zz` in rust-lang#83359. A benchmark was run[^perf], the results (after a bit of thinking[^thinking]) were deemed ok[^ok], but there was a typo[^typo] and the PR was made from a wrong remote in the first place[^remote], so rust-lang#83909 was opened instead.

By the time rust-lang#83909 rolled around, the methods in question had received some optimizations[^optimizations], so another perf run was conducted[^perf2]. The results were ok[^ok2]. There was a suggestion to add regression tests for panic behavior [^tests], but before it could be addressed, the PR fell victim to merge conflicts[^conflicts] and died again[^rip].

3 years have passed, and (from what I can tell) this has not been tried again, so here I am now, reviving this old effort.

Given how much time has passed and the fact that I've also touched `VecDeque` this time, it probably makes sense to
`@bors` try `@rust-timer`

[^perf]: rust-lang#83359 (comment)
[^thinking]: rust-lang#83359 (comment)
[^ok]: rust-lang#83359 (comment)
[^typo]: rust-lang#83359 (comment)
[^remote]: rust-lang#83359 (comment)
[^optimizations]: rust-lang#83909 (comment)
[^perf2]: rust-lang#83909 (comment)
[^ok2]: rust-lang#83909 (comment)
[^tests]: rust-lang#83909 (comment)
[^conflicts]: rust-lang#83909 (comment)
[^rip]: rust-lang#83909 (comment)
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 14, 2024
Add `#[track_caller]` to allocating methods of `Vec` & `VecDeque`

Part 4 in a lengthy saga.
r? `@joshtriplett` because they were the reviewer the last 3 times.
`@bors` rollup=never "[just in case this has perf effects, Vec is hot](rust-lang#79323 (comment))"

This was first attempted in rust-lang#79323 by `@nvzqz.` It got approval from `@joshtriplett,` but rotted with merge conflicts and got closed.

Then it got picked up by `@Dylan-DPC-zz` in rust-lang#83359. A benchmark was run[^perf], the results (after a bit of thinking[^thinking]) were deemed ok[^ok], but there was a typo[^typo] and the PR was made from a wrong remote in the first place[^remote], so rust-lang#83909 was opened instead.

By the time rust-lang#83909 rolled around, the methods in question had received some optimizations[^optimizations], so another perf run was conducted[^perf2]. The results were ok[^ok2]. There was a suggestion to add regression tests for panic behavior [^tests], but before it could be addressed, the PR fell victim to merge conflicts[^conflicts] and died again[^rip].

3 years have passed, and (from what I can tell) this has not been tried again, so here I am now, reviving this old effort.

Given how much time has passed and the fact that I've also touched `VecDeque` this time, it probably makes sense to
`@bors` try `@rust-timer`

[^perf]: rust-lang#83359 (comment)
[^thinking]: rust-lang#83359 (comment)
[^ok]: rust-lang#83359 (comment)
[^typo]: rust-lang#83359 (comment)
[^remote]: rust-lang#83359 (comment)
[^optimizations]: rust-lang#83909 (comment)
[^perf2]: rust-lang#83909 (comment)
[^ok2]: rust-lang#83909 (comment)
[^tests]: rust-lang#83909 (comment)
[^conflicts]: rust-lang#83909 (comment)
[^rip]: rust-lang#83909 (comment)
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Oct 14, 2024
Add `#[track_caller]` to allocating methods of `Vec` & `VecDeque`

Part 4 in a lengthy saga.
r? `@joshtriplett` because they were the reviewer the last 3 times.
`@bors` rollup=never "[just in case this has perf effects, Vec is hot](rust-lang/rust#79323 (comment))"

This was first attempted in #79323 by `@nvzqz.` It got approval from `@joshtriplett,` but rotted with merge conflicts and got closed.

Then it got picked up by `@Dylan-DPC-zz` in #83359. A benchmark was run[^perf], the results (after a bit of thinking[^thinking]) were deemed ok[^ok], but there was a typo[^typo] and the PR was made from a wrong remote in the first place[^remote], so #83909 was opened instead.

By the time #83909 rolled around, the methods in question had received some optimizations[^optimizations], so another perf run was conducted[^perf2]. The results were ok[^ok2]. There was a suggestion to add regression tests for panic behavior [^tests], but before it could be addressed, the PR fell victim to merge conflicts[^conflicts] and died again[^rip].

3 years have passed, and (from what I can tell) this has not been tried again, so here I am now, reviving this old effort.

Given how much time has passed and the fact that I've also touched `VecDeque` this time, it probably makes sense to
`@bors` try `@rust-timer`

[^perf]: rust-lang/rust#83359 (comment)
[^thinking]: rust-lang/rust#83359 (comment)
[^ok]: rust-lang/rust#83359 (comment)
[^typo]: rust-lang/rust#83359 (comment)
[^remote]: rust-lang/rust#83359 (comment)
[^optimizations]: rust-lang/rust#83909 (comment)
[^perf2]: rust-lang/rust#83909 (comment)
[^ok2]: rust-lang/rust#83909 (comment)
[^tests]: rust-lang/rust#83909 (comment)
[^conflicts]: rust-lang/rust#83909 (comment)
[^rip]: rust-lang/rust#83909 (comment)
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Oct 17, 2024
Add `#[track_caller]` to allocating methods of `Vec` & `VecDeque`

Part 4 in a lengthy saga.
r? `@joshtriplett` because they were the reviewer the last 3 times.
`@bors` rollup=never "[just in case this has perf effects, Vec is hot](rust-lang/rust#79323 (comment))"

This was first attempted in #79323 by `@nvzqz.` It got approval from `@joshtriplett,` but rotted with merge conflicts and got closed.

Then it got picked up by `@Dylan-DPC-zz` in #83359. A benchmark was run[^perf], the results (after a bit of thinking[^thinking]) were deemed ok[^ok], but there was a typo[^typo] and the PR was made from a wrong remote in the first place[^remote], so #83909 was opened instead.

By the time #83909 rolled around, the methods in question had received some optimizations[^optimizations], so another perf run was conducted[^perf2]. The results were ok[^ok2]. There was a suggestion to add regression tests for panic behavior [^tests], but before it could be addressed, the PR fell victim to merge conflicts[^conflicts] and died again[^rip].

3 years have passed, and (from what I can tell) this has not been tried again, so here I am now, reviving this old effort.

Given how much time has passed and the fact that I've also touched `VecDeque` this time, it probably makes sense to
`@bors` try `@rust-timer`

[^perf]: rust-lang/rust#83359 (comment)
[^thinking]: rust-lang/rust#83359 (comment)
[^ok]: rust-lang/rust#83359 (comment)
[^typo]: rust-lang/rust#83359 (comment)
[^remote]: rust-lang/rust#83359 (comment)
[^optimizations]: rust-lang/rust#83909 (comment)
[^perf2]: rust-lang/rust#83909 (comment)
[^ok2]: rust-lang/rust#83909 (comment)
[^tests]: rust-lang/rust#83909 (comment)
[^conflicts]: rust-lang/rust#83909 (comment)
[^rip]: rust-lang/rust#83909 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants