| commit | d152dbb0e8c18e2ee62e9b0376e5fc55b837b6be | [log] [tgz] |
|---|---|---|
| author | bors <bors@rust-lang.org> | Fri Jun 20 02:55:43 2025 +0000 |
| committer | bors <bors@rust-lang.org> | Fri Jun 20 02:55:43 2025 +0000 |
| tree | 8aa0df5738de2379866a3d187e21cbfc2372b81c | |
| parent | 60f977bd80ce06067079b8267579fb4e70b61ed1 [diff] | |
| parent | 6da11e1510b2325469ab5b2778034d0dec19efff [diff] |
Auto merge of #142294 - GuillaumeGomez:specialize-tostring-on-128-integers, r=tgross35 Use a distinct `ToString` implementation for `u128` and `i128` Part of https://github.com/rust-lang/rust/issues/135543. Follow-up of rust-lang/rust#136264. When working on https://github.com/rust-lang/rust/pull/142098, I realized that `i128` and `u128` could also benefit from a distinct `ToString` implementation so here it. The last commit is just me realizing that I forgot to add the format tests for `usize` and `isize`. Here is the bench comparison: | bench name | last nightly | with this PR | diff | |-|-|-|-| | bench_i128 | 29.25 ns/iter (+/- 0.66) | 17.52 ns/iter (+/- 0.7) | -40.1% | | bench_u128 | 34.06 ns/iter (+/- 0.21) | 16.1 ns/iter (+/- 0.6) | -52.7% | I used this code to test: ```rust #![feature(test)] extern crate test; use test::{Bencher, black_box}; #[inline(always)] fn convert_to_string<T: ToString>(n: T) -> String { n.to_string() } macro_rules! decl_benches { ($($name:ident: $ty:ident,)+) => { $( #[bench] fn $name(c: &mut Bencher) { c.iter(|| convert_to_string(black_box({ let nb: $ty = 20; nb }))); } )+ } } decl_benches! { bench_u128: u128, bench_i128: i128, } ```
rust-analyzer is a modular compiler frontend for the Rust language. It is a part of a larger rls-2.0 effort to create excellent IDE support for Rust.
https://rust-analyzer.github.io/book/installation.html
If you want to contribute to rust-analyzer check out the CONTRIBUTING.md or if you are just curious about how things work under the hood, see the Contributing section of the manual.
If you want to use rust-analyzer's language server with your editor of choice, check the manual. It also contains some tips & tricks to help you be more productive when using rust-analyzer.
See the security and privacy sections of the manual.
For usage and troubleshooting requests, please use “IDEs and Editors” category of the Rust forum:
https://users.rust-lang.org/c/ide/14
For questions about development and implementation, join rust-analyzer working group on Zulip:
https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer
rust-analyzer is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.