Skip to content

Improve NumBufferTrait associated items#157976

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GuillaumeGomez:numbuffertrait-improvement
Jun 20, 2026
Merged

Improve NumBufferTrait associated items#157976
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GuillaumeGomez:numbuffertrait-improvement

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

It allows for NumBuffer::buf size to depend on the integer instead of being the same for all integers.

The idea was suggested by @Amanieu (thanks a lot!).

r? @Amanieu

…ze depends on the integer instead of being the same for all integers
@rustbot

rustbot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in integer formatting

cc @tgross35

@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 Jun 16, 2026
@Amanieu

Amanieu commented Jun 19, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c558f6b has been approved by Amanieu

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Jun 19, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 20, 2026
Rollup of 3 pull requests

Successful merges:

 - #157976 (Improve `NumBufferTrait` associated items)
 - #157382 (Suggest `type` next to visibility for const items)
 - #158157 (Use the direct `From` in `Clone for OnceLock<T>`)
@rust-bors

rust-bors Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

⌛ Testing commit c558f6b with merge 22398ff...

Workflow: https://github.com/rust-lang/rust/actions/runs/27855057977

rust-bors Bot pushed a commit that referenced this pull request Jun 20, 2026
…Amanieu

Improve `NumBufferTrait` associated items

It allows for `NumBuffer::buf` size to depend on the integer instead of being the same for all integers.

The idea was suggested by @Amanieu (thanks a lot!).

r? @Amanieu
@jhpratt

jhpratt commented Jun 20, 2026

Copy link
Copy Markdown
Member

yielding to rollup

@bors yield

@rust-bors

rust-bors Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #158162.

rust-bors Bot pushed a commit that referenced this pull request Jun 20, 2026
Rollup of 3 pull requests

Successful merges:

 - #157976 (Improve `NumBufferTrait` associated items)
 - #157382 (Suggest `type` next to visibility for const items)
 - #158157 (Use the direct `From` in `Clone for OnceLock<T>`)
@rust-bors rust-bors Bot merged commit 45fdd98 into rust-lang:main Jun 20, 2026
13 of 14 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 20, 2026
rust-timer added a commit that referenced this pull request Jun 20, 2026
Rollup merge of #157976 - GuillaumeGomez:numbuffertrait-improvement, r=Amanieu

Improve `NumBufferTrait` associated items

It allows for `NumBuffer::buf` size to depend on the integer instead of being the same for all integers.

The idea was suggested by @Amanieu (thanks a lot!).

r? @Amanieu
@jhpratt

jhpratt commented Jun 20, 2026

Copy link
Copy Markdown
Member

@rust-timer build 94ec748

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (94ec748): comparison URL.

Overall result: ❌ regressions - 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
@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.2%, 0.8%] 7
Regressions ❌
(secondary)
0.6% [0.1%, 1.1%] 21
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 0.8%] 7

Max RSS (memory usage)

Results (primary 2.8%)

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

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 3.9%)

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

Binary size

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

Bootstrap: 489.308s -> 480.969s (-1.70%)
Artifact size: 390.69 MiB -> 390.68 MiB (-0.00%)

@rustbot rustbot added the perf-regression Performance regression. label Jun 20, 2026
@GuillaumeGomez GuillaumeGomez deleted the numbuffertrait-improvement branch June 20, 2026 09:53
@GuillaumeGomez

GuillaumeGomez commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

I'm surprised: is any of these using NumBuffer? O.o

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

The regression is rustdoc becoming slower in processing these crates, does rustdoc depend on this?

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

rustdoc doesn't use NumBuffer either.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

It might be doing so indirectly, it seems like NumBuffer is used in the stdlib to format integers in to

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Nope, nothing is using NumBuffer in the stdlib. ;)

@@ -758,7 +758,7 @@ impl u128 {
/// ```
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
pub fn format_into(self, buf: &mut NumBuffer<Self>) -> &str {

@JonathanBrouwer JonathanBrouwer Jun 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, it's being used here at least, isn't it?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's the API added alongside NumBuffer. It's not used anywhere (yet?) in rustc/rustdoc/std.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah ok, then I have no clue what's causing this, weird

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Welcome to the club. :')

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 26, 2026
…r=Amanieu

Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`

A [nice person from mastodon](https://toot.cat/@jamey/116815991086205506) pointed out that a `FIXME` comment should have been removed alongside the others in rust-lang#157976, and also pointed out that the documentation mentions that `ilog10` is more optimized than `ilog(10)`. Shouldn't matter much here but since I already made a PR to remove the FIXME comment...

r? @Amanieu
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 26, 2026
…r=Amanieu

Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`

A [nice person from mastodon](https://toot.cat/@jamey/116815991086205506) pointed out that a `FIXME` comment should have been removed alongside the others in rust-lang#157976, and also pointed out that the documentation mentions that `ilog10` is more optimized than `ilog(10)`. Shouldn't matter much here but since I already made a PR to remove the FIXME comment...

r? @Amanieu
pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Jun 27, 2026
Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`

A [nice person from mastodon](https://toot.cat/@jamey/116815991086205506) pointed out that a `FIXME` comment should have been removed alongside the others in rust-lang/rust#157976, and also pointed out that the documentation mentions that `ilog10` is more optimized than `ilog(10)`. Shouldn't matter much here but since I already made a PR to remove the FIXME comment...

r? @Amanieu
pull Bot pushed a commit to Kokoro2336/rust-analyzer that referenced this pull request Jun 29, 2026
Cleanup `NumBuffer` comment and replace `ilog(10)` with `ilog10()`

A [nice person from mastodon](https://toot.cat/@jamey/116815991086205506) pointed out that a `FIXME` comment should have been removed alongside the others in rust-lang/rust#157976, and also pointed out that the documentation mentions that `ilog10` is more optimized than `ilog(10)`. Shouldn't matter much here but since I already made a PR to remove the FIXME comment...

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

Labels

perf-regression Performance regression. 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.

6 participants