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

Removed dependency on the field-offset crate. #136003

Closed

Conversation

davidv1992
Copy link
Contributor

This touches the core of the query system, should be evaluated carefully for performance.

@rustbot
Copy link
Collaborator

rustbot commented Jan 24, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 24, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@bjorn3
Copy link
Member

bjorn3 commented Jan 24, 2025

This was spawned from #135870 (comment). The field-offset crate doesn't work with strict provenance, which miri forces when using tree borrows.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 24, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 24, 2025
…=<try>

Removed dependency on the field-offset crate.

This touches the core of the query system, should be evaluated carefully for performance.
@bors
Copy link
Contributor

bors commented Jan 24, 2025

⌛ Trying commit 2681c12 with merge 84dc1fa...

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 24, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2025
@davidv1992 davidv1992 force-pushed the eliminate-field-offset branch from 2681c12 to 5fd7599 Compare January 24, 2025 15:59
@bjorn3
Copy link
Member

bjorn3 commented Jan 24, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 24, 2025

⌛ Trying commit 5fd7599 with merge 4405608...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 24, 2025
…=<try>

Removed dependency on the field-offset crate.

This touches the core of the query system, should be evaluated carefully for performance.
@davidv1992 davidv1992 force-pushed the eliminate-field-offset branch from 5fd7599 to 878cdda Compare January 24, 2025 16:08
@rustbot rustbot added A-tidy Area: The tidy tool T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jan 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 24, 2025

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

@davidv1992
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 24, 2025
@rust-log-analyzer

This comment has been minimized.

@davidv1992 davidv1992 force-pushed the eliminate-field-offset branch from 878cdda to 4efb1b1 Compare January 24, 2025 21:03
@clubby789
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 25, 2025

⌛ Trying commit 4efb1b1 with merge 09d1d97...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
…=<try>

Removed dependency on the field-offset crate.

This touches the core of the query system, should be evaluated carefully for performance.
@bors
Copy link
Contributor

bors commented Jan 25, 2025

☀️ Try build successful - checks-actions
Build commit: 09d1d97 (09d1d9737e9dbfb5a92ebd468721f4589b6e8454)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (09d1d97): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking 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 @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.5%] 11
Regressions ❌
(secondary)
0.3% [0.1%, 0.5%] 29
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.1%, 0.5%] 11

Max RSS (memory usage)

Results (primary 2.8%)

This 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.

mean range count
Regressions ❌
(primary)
2.8% [2.8%, 2.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.8% [2.8%, 2.8%] 1

Cycles

Results (secondary 2.8%)

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.8% [2.6%, 2.9%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 771.063s -> 769.268s (-0.23%)
Artifact size: 325.77 MiB -> 325.97 MiB (0.06%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jan 25, 2025
@davidv1992
Copy link
Contributor Author

Hmmm, not entirely sure what causes the RSS size increase, that one feels weird to me. However, the increase in instruction count is less than I would have expected, given that this replaces a most likely inlineable function with an indirect function call. I feel the advantages of completely avoiding unsafe code and reducing the dependency list by two dependencies here are worth it.

However if this is deemed too large a regression I can also build a second approach that directly uses offset calculations. That would involve unsafe code but would still eliminate the dependency and removes the need for the indirect function call.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jan 26, 2025
@Mark-Simulacrum
Copy link
Member

My guess is that the max-rss regression on a single test case is likely spurious.

IMO, either replacing this with storing the offsets and doing the indexing with unsafe code or upstreaming strict provenance to the field offset crate would make sense. (Or both). I don't think there's much value in regressing here -- especially given the ~150kb of code this seems to add (probably due to the tiny offset functions).

@davidv1992
Copy link
Contributor Author

I would suggest we move away from the dependency, as it seems to be unmaintained, and even if it isn't it currently has a bus factor of 1. Given that it really is used in so few places, I think it's just not worth it to keep around. I will make a version doing the offset calculation directly later tonight (CET) so we can compare.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 29, 2025
…t, r=<try>

Removed dependency on the field-offset crate, alternate approach

This is an alternate approach to reach the same goals as rust-lang#136003. As it touches the core of the query system, this too probably should be evaluated for performance.

r? `@Mark-Simulacrum`
@Mark-Simulacrum
Copy link
Member

Replaced by #136201.

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 1, 2025
…t, r=Mark-Simulacrum

Removed dependency on the field-offset crate, alternate approach

This is an alternate approach to reach the same goals as rust-lang#136003. As it touches the core of the query system, this too probably should be evaluated for performance.

r? `@Mark-Simulacrum`
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 10, 2025
…alt, r=Mark-Simulacrum

Removed dependency on the field-offset crate, alternate approach

This is an alternate approach to reach the same goals as rust-lang#136003. As it touches the core of the query system, this too probably should be evaluated for performance.

r? `@Mark-Simulacrum`
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Feb 10, 2025
…alt, r=Mark-Simulacrum

Removed dependency on the field-offset crate, alternate approach

This is an alternate approach to reach the same goals as rust-lang#136003. As it touches the core of the query system, this too probably should be evaluated for performance.

r? ``@Mark-Simulacrum``
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
Rollup merge of rust-lang#136201 - davidv1992:eliminate-field-offset-alt, r=Mark-Simulacrum

Removed dependency on the field-offset crate, alternate approach

This is an alternate approach to reach the same goals as rust-lang#136003. As it touches the core of the query system, this too probably should be evaluated for performance.

r? ``@Mark-Simulacrum``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-tidy Area: The tidy tool perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants