Skip to content

[perf] Use a flat token stream representation when lexing - #159378

Draft
Kobzol wants to merge 1 commit into
rust-lang:mainfrom
Kobzol:lexer-flat
Draft

[perf] Use a flat token stream representation when lexing#159378
Kobzol wants to merge 1 commit into
rust-lang:mainfrom
Kobzol:lexer-flat

Conversation

@Kobzol

@Kobzol Kobzol commented Jul 16, 2026

Copy link
Copy Markdown
Member

View all comments

Opening for a perf experiment, nothing to see here.

@rustbot rustbot added 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. labels Jul 16, 2026
@Kobzol

Kobzol commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

@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 Jul 16, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 16, 2026
[perf] Use a flat token stream representation when lexing
@rust-bors

rust-bors Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 8374c7c (8374c7ca6b40db24e90f1c62568ddd867a1d48ce)
Base parent: ab4bbeb (ab4bbeb07dc7dc2d30e9f83d3e0326df981e0ee2)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (8374c7c): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.4% [0.1%, 1.2%] 73
Regressions ❌
(secondary)
0.6% [0.1%, 1.4%] 59
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.8% [-2.4%, -1.3%] 13
All ❌✅ (primary) 0.4% [0.1%, 1.2%] 73

Max RSS (memory usage)

Results (secondary -6.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.9% [1.8%, 8.5%] 14
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-13.6% [-22.8%, -2.3%] 21
All ❌✅ (primary) - - 0

Cycles

Results (primary 1.1%, secondary -7.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.6% [2.4%, 3.0%] 3
Regressions ❌
(secondary)
3.5% [2.1%, 5.2%] 8
Improvements ✅
(primary)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
-13.6% [-19.9%, -4.9%] 14
All ❌✅ (primary) 1.1% [-3.4%, 3.0%] 4

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 489.393s -> 489.02s (-0.08%)
Artifact size: 389.94 MiB -> 389.88 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 16, 2026
@Kobzol

Kobzol commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

Seems like doing the flat representation in the lexer doesn't help much when we still have to convert it back to all the allocations required for the parser. The whole thing would have to be flattened to have the desired perf. effect.

@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Aug 25, 2026
@Kobzol

Kobzol commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

@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 Aug 25, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 25, 2026
[perf] Use a flat token stream representation when lexing
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 5588d8a failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol

Kobzol commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 25, 2026
[perf] Use a flat token stream representation when lexing
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 0ea5705 (0ea5705702a45a8dd68a0f34aa0c62e3d1b1ca95)
Base parent: cc05892 (cc05892c8346313865afd91ca12ee1fde6d3603c)

@rust-timer

This comment has been minimized.

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 25, 2026
@Kobzol

Kobzol commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

@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 Aug 26, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 26, 2026
[perf] Use a flat token stream representation when lexing
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 8bcb09e failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol

Kobzol commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 26, 2026
[perf] Use a flat token stream representation when lexing
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 32559b2 (32559b2e346e755d7cfe72e6d57ace068ce16a1a)
Base parent: e081d66 (e081d6616f3be5a96c6b42eecc6410f1a5378b7e)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (32559b2): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
1.8% [0.1%, 11.2%] 127
Regressions ❌
(secondary)
4.1% [0.1%, 38.0%] 99
Improvements ✅
(primary)
-0.6% [-2.5%, -0.2%] 60
Improvements ✅
(secondary)
-1.4% [-5.9%, -0.1%] 55
All ❌✅ (primary) 1.0% [-2.5%, 11.2%] 187

Max RSS (memory usage)

Results (primary -2.2%, secondary -0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.7% [1.7%, 1.7%] 1
Regressions ❌
(secondary)
4.8% [0.8%, 16.6%] 18
Improvements ✅
(primary)
-2.3% [-4.3%, -0.8%] 88
Improvements ✅
(secondary)
-3.4% [-10.2%, -1.4%] 33
All ❌✅ (primary) -2.2% [-4.3%, 1.7%] 89

Cycles

Results (primary 6.0%, secondary 16.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
6.0% [1.9%, 14.0%] 33
Regressions ❌
(secondary)
20.4% [1.8%, 85.8%] 40
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.4% [-5.8%, -2.1%] 7
All ❌✅ (primary) 6.0% [1.9%, 14.0%] 33

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 473.971s -> 476.786s (0.59%)
Artifact size: 402.61 MiB -> 402.69 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 26, 2026
@Kobzol

Kobzol commented Aug 29, 2026

Copy link
Copy Markdown
Member Author

@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 Aug 29, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 29, 2026
[perf] Use a flat token stream representation when lexing
@rust-bors

rust-bors Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 41bfd27 (41bfd27447b6da2214d1c73b14037a50d34b84c3)
Base parent: fd7ed57 (fd7ed57dfd3bdebb745a1d8158638727b0e7047a)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (41bfd27): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.6% [0.1%, 1.6%] 45
Regressions ❌
(secondary)
1.1% [0.1%, 3.3%] 41
Improvements ✅
(primary)
-0.3% [-0.4%, -0.1%] 8
Improvements ✅
(secondary)
-2.4% [-4.7%, -0.1%] 22
All ❌✅ (primary) 0.5% [-0.4%, 1.6%] 53

Max RSS (memory usage)

Results (secondary 0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.7% [2.9%, 10.0%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.0% [-10.1%, -1.5%] 8
All ❌✅ (primary) - - 0

Cycles

Results (primary 2.3%, secondary 2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.3% [1.3%, 2.6%] 9
Regressions ❌
(secondary)
2.4% [1.9%, 3.0%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.3% [1.3%, 2.6%] 9

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 476.157s -> 473.87s (-0.48%)
Artifact size: 402.84 MiB -> 402.90 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 29, 2026
@rust-bors

rust-bors Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #162183) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) perf-regression Performance regression. 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.

4 participants