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

Make skip_whitespace do a single pass (with bytes) #137275

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hkBst
Copy link
Member

@hkBst hkBst commented Feb 19, 2025

Probably better alternative to #137027.

r? @nnethercote

@rustbot rustbot added 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 Feb 19, 2025
@hkBst hkBst marked this pull request as ready for review February 19, 2025 14:18
@jieyouxu
Copy link
Member

@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 Feb 19, 2025
@bors
Copy link
Contributor

bors commented Feb 19, 2025

⌛ Trying commit d4feb08 with merge f62fb4e...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 19, 2025
…try>

Make skip_whitespace do a single pass (with bytes)

Probably better alternative to rust-lang#137027.

r? `@nnethercote`
@bors
Copy link
Contributor

bors commented Feb 19, 2025

☀️ Try build successful - checks-actions
Build commit: f62fb4e (f62fb4e8b41a377accf89c9d5ea21df1c1333251)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f62fb4e): comparison URL.

Overall result: no relevant changes - no action needed

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.

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

Instruction count

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

Max RSS (memory usage)

Results (primary -1.6%)

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)
- - 0
Improvements ✅
(primary)
-1.6% [-1.6%, -1.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.6% [-1.6%, -1.6%] 1

Cycles

Results (primary -4.0%)

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)
- - 0
Improvements ✅
(primary)
-4.0% [-5.9%, -1.6%] 6
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -4.0% [-5.9%, -1.6%] 6

Binary size

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

Bootstrap: 773.063s -> 774.969s (0.25%)
Artifact size: 362.34 MiB -> 362.33 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 19, 2025
@nnethercote
Copy link
Contributor

@hkBst: is this ready for review?

@rust-log-analyzer

This comment has been minimized.

@hkBst hkBst force-pushed the single_pass_skip_ws_bytes branch from 7089355 to 258115e Compare February 20, 2025 07:31
@hkBst
Copy link
Member Author

hkBst commented Feb 20, 2025

@nnethercote I've now added @folkertdev's changes which look like an improvement, so another perf run would be good, but yes in principle this is ready for review.

@nnethercote
Copy link
Contributor

@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 Feb 20, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 20, 2025
…try>

Make skip_whitespace do a single pass (with bytes)

Probably better alternative to rust-lang#137027.

r? `@nnethercote`
@bors
Copy link
Contributor

bors commented Feb 20, 2025

⌛ Trying commit 258115e with merge 665ef7c...

@bors
Copy link
Contributor

bors commented Feb 20, 2025

☀️ Try build successful - checks-actions
Build commit: 665ef7c (665ef7c7cc094b58b3753cbd33b8ce51dfaf4142)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (665ef7c): comparison URL.

Overall result: no relevant changes - no action needed

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.

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

Instruction count

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

Max RSS (memory usage)

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

Cycles

Results (secondary 1.3%)

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)
5.7% [5.7%, 5.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.2% [-3.2%, -3.2%] 1
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 772.938s -> 773.607s (0.09%)
Artifact size: 360.27 MiB -> 360.30 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 20, 2025
Copy link
Contributor

@folkertdev folkertdev left a comment

Choose a reason for hiding this comment

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

As a general question, would we ever expect (small) parser changes to show up as significant in the overall performance benchmarks? Surely that gets drowned out by semantic analysis and (if used) codegen?

@hkBst
Copy link
Member Author

hkBst commented Feb 20, 2025

As a general question, would we ever expect (small) parser changes to show up as significant in the overall performance benchmarks? Surely that gets drowned out by semantic analysis and (if used) codegen?

This is probably too specific, as it only affects strings that use whitespace continuation, and makes that part a bit faster (probably?). But small changes can have like a -0.1% effect.

@hkBst hkBst force-pushed the single_pass_skip_ws_bytes branch from f847211 to 9456ea7 Compare February 20, 2025 19:36
@nnethercote
Copy link
Contributor

As a general question, would we ever expect (small) parser changes to show up as significant in the overall performance benchmarks? Surely that gets drowned out by semantic analysis and (if used) codegen?

They can definitely show up in incremental builds that have few or no changes, because parsing isn't incremental. And also check builds. See #136931 for a recent related example that had to be abandoned for perf regressions.

@hkBst hkBst force-pushed the single_pass_skip_ws_bytes branch from 9456ea7 to ddc330a Compare March 17, 2025 11:57
@rust-log-analyzer

This comment has been minimized.

@hkBst hkBst force-pushed the single_pass_skip_ws_bytes branch from ddc330a to 38f2aa8 Compare March 17, 2025 12:12
@rust-log-analyzer

This comment has been minimized.

@hkBst hkBst force-pushed the single_pass_skip_ws_bytes branch from 38f2aa8 to 377a6fb Compare March 17, 2025 12:45
Co-authored-by: Folkert de Vries <flokkievids@gmail.com>
@hkBst hkBst force-pushed the single_pass_skip_ws_bytes branch from 377a6fb to cf62cd9 Compare March 17, 2025 13:00
@hkBst hkBst marked this pull request as draft March 17, 2025 13:42
@nnethercote nnethercote 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 Mar 18, 2025
@hkBst
Copy link
Member Author

hkBst commented Mar 18, 2025

I've been running some performance tests, and even in the best case scenario, this change seems to perform 25% worse than the current double traversal... so I may have to pivot to documenting that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

None yet

8 participants