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
ast_lowering: Make some asserts in ID generation debug only. #119234
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…r=<try> ast_lowering: Make some asserts debug only. Ran into this code, as was kinda surprised these are still here in release. These methods seem hot. r? `@ghost` `@bors` try `@rust-timer` queue
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (3927ced): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 672.389s -> 670.281s (-0.31%) |
r? compiler |
Failed to set assignee to
|
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.
One nit -- I think if we use debug_assert_eq
we get nicer diagnostics
0c7ec74
to
bfbc952
Compare
assert!( | ||
self.opt_local_def_id(node_id).is_none(), | ||
debug_assert_eq!( | ||
self.opt_local_def_id(node_id), |
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.
Not very hot (only called for definitions created by syntactic sugar), but the assert performs a non-trivial calculation.
Not sure about usefulness of this assert.
@@ -702,7 +703,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { | |||
/// properly. Calling the method twice with the same `NodeId` is fine though. | |||
#[instrument(level = "debug", skip(self), ret)] | |||
fn lower_node_id(&mut self, ast_node_id: NodeId) -> hir::HirId { | |||
assert_ne!(ast_node_id, DUMMY_NODE_ID); | |||
debug_assert_ne!(ast_node_id, DUMMY_NODE_ID); |
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.
Hot (called for most nodes in code), but the assert is trivial.
This asserts looks pretty useful.
@@ -717,7 +718,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { | |||
v.insert(local_id); | |||
self.item_local_id_counter.increment_by(1); | |||
|
|||
assert_ne!(local_id, hir::ItemLocalId::new(0)); | |||
debug_assert_ne!(local_id, hir::ItemLocalId::new(0)); |
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.
Hot (called for most nodes in code), but the assert is trivial.
Not sure about usefulness of this assert.
@@ -736,7 +737,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { | |||
fn next_id(&mut self) -> hir::HirId { | |||
let owner = self.current_hir_id_owner; | |||
let local_id = self.item_local_id_counter; | |||
assert_ne!(local_id, hir::ItemLocalId::new(0)); | |||
debug_assert_ne!(local_id, hir::ItemLocalId::new(0)); |
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.
Not very hot (only called for nodes created by syntactic sugar), and the assert is trivial.
Not sure about usefulness of this assert.
I'd generally prefer to keep useful asserts unless they provably regress performance. |
I agree with petrochenkov's thoughts above. Could we restore the ones that petrochenkov said were useful assertions? |
bfbc952
to
f3a7297
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…r=<try> ast_lowering: Make some asserts in ID generation debug only. Ran into this code, as was kinda surprised these are still here in release. These methods seem hot. r? `@ghost` `@bors` try `@rust-timer` queue
Finished benchmarking commit (0d3dccf): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Warning ⚠: The following benchmark(s) failed to build:
Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 669.724s -> 668.771s (-0.14%) |
f3a7297
to
03be3e3
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…r=<try> ast_lowering: Make some asserts in ID generation debug only. Ran into this code, as was kinda surprised these are still here in release. These methods seem hot. r? `@ghost` `@bors` try `@rust-timer` queue
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (970345b): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 671.25s -> 671.556s (0.05%) |
03be3e3
to
93781e5
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…r=<try> ast_lowering: Make some asserts in ID generation debug only. Ran into this code, as was kinda surprised these are still here in release. These methods seem hot. r? `@ghost` `@bors` try `@rust-timer` queue
☀️ Try build successful - checks-actions |
1 similar comment
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (7837f42): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 670.702s -> 671.644s (0.14%) |
@aDotInTheVoid any updates on this? |
Not certain that this work is up to date anymore |
Ran into this code, as was kinda surprised these are still here in release. These methods seem hot.
r? @ghost
@bors try @rust-timer queue