Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1123738

Browse files
committedMay 7, 2024·
Use static dispatch
1 parent 6c9385c commit 1123738

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 

‎opentelemetry/benches/attributes.rs

+17
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ fn attributes_creation(c: &mut Criterion) {
4040
});
4141
});
4242

43+
c.bench_function("CreateTupleKeyValueUsingGenerics", |b| {
44+
b.iter(|| {
45+
let _v1 = black_box(no_op("attribute1", "value1"));
46+
});
47+
});
48+
4349
#[allow(clippy::useless_vec)]
4450
c.bench_function("CreateOtelKeyValueVector", |b| {
4551
b.iter(|| {
@@ -65,6 +71,17 @@ fn attributes_creation(c: &mut Criterion) {
6571
});
6672
}
6773

74+
75+
trait OTelValueType {}
76+
77+
impl OTelValueType for u32 {}
78+
79+
impl OTelValueType for &str {}
80+
81+
fn no_op<T : OTelValueType>(key: &'static str, value: T) {
82+
black_box("test");
83+
}
84+
6885
criterion_group!(benches, criterion_benchmark);
6986

7087
criterion_main!(benches);

0 commit comments

Comments
 (0)
Please sign in to comment.