Created
July 15, 2020 16:57
-
-
Save mexus/4a8fcaff64c4c0bbc1b027770d9aa979 to your computer and use it in GitHub Desktop.
`Arc::clone` performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use criterion::{criterion_group, criterion_main, Criterion}; | |
use std::sync::Arc; | |
fn criterion_benchmark(c: &mut Criterion) { | |
c.bench_function("arc", |b| { | |
let arc = Arc::new(String::from("Some string")); | |
b.iter(|| { | |
let clone = Arc::clone(&arc); | |
clone | |
}) | |
}); | |
} | |
criterion_group!(benches, criterion_benchmark); | |
criterion_main!(benches); |
Author
mexus
commented
Jul 15, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment