-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-pedanticLint: Belongs in the pedantic lint groupLint: Belongs in the pedantic lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
From rust-lang/rust#52805 (comment). String::new()
is faster than ""::to_string()
#[bench]
fn bench_string_new(b: &mut Bencher) {
b.iter(|| String::new());
}
#[bench]
fn bench_to_string(b: &mut Bencher) {
b.iter(|| "".to_string());
}
running 2 tests
test tests::bench_string_new ... bench: 0 ns/iter (+/- 0)
test tests::bench_to_string ... bench: 8 ns/iter (+/- 0)
ljedrz, aloucks, mati865, jens1o, NilsIrl and 1 more
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-pedanticLint: Belongs in the pedantic lint groupLint: Belongs in the pedantic lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy