Skip to content

Conversation

@lolbinarycat
Copy link
Contributor

@lolbinarycat lolbinarycat commented Dec 5, 2025

Here's a small optimization via specialization that can potentially eliminate a fair few reallocations when building strings using specific patterns, unsure if this justifies the use of unsafe, but I had the code implemented from #148604, so I thought it was worth submitting to see.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 5, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 5, 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

@Kobzol
Copy link
Member

Kobzol commented Dec 5, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 5, 2025
…r=<try>

alloc: specialize String::extend for slices of str
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 5, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Dec 5, 2025

☀️ Try build successful (CI)
Build commit: 281de2c (281de2c09f393bab648058208a34357b68b660d1, parent: 66428d92bec337ed4785d695d0127276a482278c)

@rust-timer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the alloc-extend-slice-of-str-spec branch 2 times, most recently from d2b3962 to 38ab135 Compare December 5, 2025 23:21
@lolbinarycat
Copy link
Contributor Author

Fixed CI failure and used saturating arithmetic

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (281de2c): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible 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 (secondary -1.0%)

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)
1.7% [0.9%, 2.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.7% [-6.2%, -1.2%] 2
All ❌✅ (primary) - - 0

Cycles

Results (primary -6.4%, secondary 0.1%)

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

Binary size

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

Bootstrap: 470.249s -> 470.338s (0.02%)
Artifact size: 386.85 MiB -> 386.82 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 6, 2025
@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 28, 2025

📌 Commit 38ab135 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 28, 2025
bors added a commit that referenced this pull request Dec 28, 2025
…r=Mark-Simulacrum

alloc: specialize String::extend for slices of str

Here's a small optimization via specialization that can potentially eliminate a fair few reallocations when building strings using specific patterns, unsure if this justifies the use of unsafe, but I had the code implemented from #148604, so I thought it was worth submitting to see.
@bors
Copy link
Collaborator

bors commented Dec 28, 2025

⌛ Testing commit 38ab135 with merge fc4be63...

@bors
Copy link
Collaborator

bors commented Dec 28, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 28, 2025
@lolbinarycat
Copy link
Contributor Author

looks like a spurious failure due to network disruption with the x86_64-apple builder.

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 29, 2025
@bors
Copy link
Collaborator

bors commented Dec 29, 2025

⌛ Testing commit 38ab135 with merge 67944d6...

@bors
Copy link
Collaborator

bors commented Dec 30, 2025

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 67944d6 to main...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 30, 2025
@bors bors merged commit 67944d6 into rust-lang:main Dec 30, 2025
12 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 30, 2025
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 56f24e0 (parent) -> 67944d6 (this PR)

Test differences

Show 363 test diffs

363 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 67944d6bec6b8fbbc3870e5365ab73cf88a9de62 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-apple-various: 4389.2s -> 3546.0s (-19.2%)
  2. dist-aarch64-apple: 8699.4s -> 7144.5s (-17.9%)
  3. x86_64-msvc-ext3: 5919.9s -> 6429.0s (+8.6%)
  4. dist-sparcv9-solaris: 5356.8s -> 4912.4s (-8.3%)
  5. dist-aarch64-msvc: 5829.8s -> 5357.5s (-8.1%)
  6. dist-various-2: 2321.6s -> 2142.8s (-7.7%)
  7. dist-x86_64-solaris: 5004.7s -> 5360.7s (+7.1%)
  8. x86_64-gnu: 8235.9s -> 7705.5s (-6.4%)
  9. dist-x86_64-llvm-mingw: 6624.8s -> 7024.0s (+6.0%)
  10. dist-armv7-linux: 5176.4s -> 4884.5s (-5.6%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (67944d6): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -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.2% [0.2%, 0.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.2%, 0.2%] 1

Max RSS (memory usage)

Results (secondary -1.0%)

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

Cycles

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

Binary size

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

Bootstrap: 482.457s -> 484.762s (0.48%)
Artifact size: 390.83 MiB -> 390.83 MiB (0.00%)

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

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library 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