Skip to content

Instantly share code, notes, and snippets.

@mexus
Created July 15, 2020 16:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mexus/4a8fcaff64c4c0bbc1b027770d9aa979 to your computer and use it in GitHub Desktop.
Save mexus/4a8fcaff64c4c0bbc1b027770d9aa979 to your computer and use it in GitHub Desktop.
`Arc::clone` performance
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);
@mexus
Copy link
Author

mexus commented Jul 15, 2020

image

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