|
1 | 1 | /* OS: Ubuntu 22.04.4 LTS (5.15.153.1-microsoft-standard-WSL2) |
2 | 2 | Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs, |
3 | 3 | RAM: 64.0 GB |
4 | | -| Test | Average time| |
5 | | -|--------------------------------|-------------| |
6 | | -| CreateOTelKey_Static | 1.2 ns | |
7 | | -| CreateOTelKey_Owned | 12.6 ns | |
8 | | -| CreateOTelKey_Arc | 23.35 ns | |
9 | | -| CreateOTelKeyValue | 3.24 ns | |
10 | | -| CreateTupleKeyValue | 671 ps | |
11 | | -| CreateOtelKeyValueArray | 18.4 ns | |
12 | | -| CreateTupleKeyValueArray | 2.73 ns | |
| 4 | +| Test | Average time| |
| 5 | +|--------------------------------------------------|-------------| |
| 6 | +| CreateOTelKey_Static | 1.2 ns | |
| 7 | +| CreateOTelKey_Owned | 12.6 ns | |
| 8 | +| CreateOTelKey_Arc | 23.35 ns | |
| 9 | +| CreateOTelKeyValue | 3.24 ns | |
| 10 | +| CreateTupleKeyValue | 671 ps | |
| 11 | +| CreateOtelKeyValueArray | 18.4 ns | |
| 12 | +| CreateOtelKeyValueArrayWithMixedValueTypes | 18.1 ns | |
| 13 | +| CreateOtelKeyValueArrayWithNonStaticValues | 90.1 ns | |
| 14 | +| CreateTupleKeyValueArray | 2.73 ns | |
13 | 15 | */ |
14 | 16 |
|
15 | 17 | use criterion::{black_box, criterion_group, criterion_main, Criterion}; |
@@ -65,6 +67,30 @@ fn attributes_creation(c: &mut Criterion) { |
65 | 67 | }); |
66 | 68 | }); |
67 | 69 |
|
| 70 | + c.bench_function("CreateOtelKeyValueArrayWithMixedValueTypes", |b| { |
| 71 | + b.iter(|| { |
| 72 | + let _v1 = black_box([ |
| 73 | + KeyValue::new("attribute1", true), |
| 74 | + KeyValue::new("attribute2", 100), |
| 75 | + KeyValue::new("attribute3", 100.5), |
| 76 | + KeyValue::new("attribute4", "value"), |
| 77 | + ]); |
| 78 | + }); |
| 79 | + }); |
| 80 | + |
| 81 | + let value = "value1value2value3value4".to_owned(); |
| 82 | + |
| 83 | + c.bench_function("CreateOtelKeyValueArrayWithNonStaticValues", |b| { |
| 84 | + b.iter(|| { |
| 85 | + let _v1 = black_box([ |
| 86 | + KeyValue::new("attribute1", value[0..6].to_owned()), // value[0..6] = "value1" |
| 87 | + KeyValue::new("attribute2", value[6..12].to_owned()), // value[6..12] = "value2" |
| 88 | + KeyValue::new("attribute3", value[12..18].to_owned()), // value[12..18] = "value3" |
| 89 | + KeyValue::new("attribute4", value[18..24].to_owned()), // value[18..24] = "value4" |
| 90 | + ]); |
| 91 | + }); |
| 92 | + }); |
| 93 | + |
68 | 94 | c.bench_function("CreateTupleKeyValueArray", |b| { |
69 | 95 | b.iter(|| { |
70 | 96 | let _v1 = black_box([ |
|
0 commit comments