Skip to content

Commit

Permalink
Update attributes benchmarks (#2064)
Browse files Browse the repository at this point in the history
  • Loading branch information
utpilla authored Aug 28, 2024
1 parent 7d47bf2 commit 29fd682
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions opentelemetry/benches/attributes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/* OS: Ubuntu 22.04.4 LTS (5.15.153.1-microsoft-standard-WSL2)
Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs,
RAM: 64.0 GB
| Test | Average time|
|--------------------------------|-------------|
| CreateOTelKey_Static | 1.2 ns |
| CreateOTelKey_Owned | 12.6 ns |
| CreateOTelKey_Arc | 23.35 ns |
| CreateOTelKeyValue | 3.24 ns |
| CreateTupleKeyValue | 671 ps |
| CreateOtelKeyValueArray | 18.4 ns |
| CreateTupleKeyValueArray | 2.73 ns |
*/

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use opentelemetry::{Key, KeyValue};
use std::sync::Arc;
Expand Down Expand Up @@ -41,9 +55,9 @@ fn attributes_creation(c: &mut Criterion) {
});

#[allow(clippy::useless_vec)]
c.bench_function("CreateOtelKeyValueVector", |b| {
c.bench_function("CreateOtelKeyValueArray", |b| {
b.iter(|| {
let _v1 = black_box(vec![
let _v1 = black_box([
KeyValue::new("attribute1", "value1"),
KeyValue::new("attribute2", "value2"),
KeyValue::new("attribute3", "value3"),
Expand All @@ -53,9 +67,9 @@ fn attributes_creation(c: &mut Criterion) {
});

#[allow(clippy::useless_vec)]
c.bench_function("CreateTupleKeyValueVector", |b| {
c.bench_function("CreateTupleKeyValueArray", |b| {
b.iter(|| {
let _v1 = black_box(vec![
let _v1 = black_box([
("attribute1", "value1"),
("attribute2", "value2"),
("attribute3", "value3"),
Expand Down

0 comments on commit 29fd682

Please sign in to comment.