Skip to content

Commit a38af16

Browse files
authored
test: Modify perf tests to pass event name correctly to avoid string allocation (open-telemetry#2762)
1 parent a66b8e9 commit a38af16

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

benches/logs.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@
1010
| noop_layer_disabled | 12 ns |
1111
| noop_layer_enabled | 25 ns |
1212
| ot_layer_disabled | 19 ns |
13-
| ot_layer_enabled | 196 ns |
13+
| ot_layer_enabled | 167 ns |
14+
15+
Hardware: Apple M4 Pro
16+
Total Number of Cores: 14 (10 performance and 4 efficiency)
17+
| Test | Average time|
18+
|-----------------------------|-------------|
19+
| log_no_subscriber | 285 ps |
20+
| noop_layer_disabled | 8 ns |
21+
| noop_layer_enabled | 14 ns |
22+
| ot_layer_disabled | 12 ns |
23+
| ot_layer_enabled | 186 ns |
1424
*/
1525

1626
use criterion::{criterion_group, criterion_main, Criterion};
@@ -94,7 +104,7 @@ fn benchmark_no_subscriber(c: &mut Criterion) {
94104
c.bench_function("log_no_subscriber", |b| {
95105
b.iter(|| {
96106
error!(
97-
name = "CheckoutFailed",
107+
name : "CheckoutFailed",
98108
book_id = "12345",
99109
book_title = "Rust Programming Adventures",
100110
message = "Unable to process checkout."
@@ -120,7 +130,7 @@ fn benchmark_with_ot_layer(c: &mut Criterion, enabled: bool, bench_name: &str) {
120130
c.bench_function(bench_name, |b| {
121131
b.iter(|| {
122132
error!(
123-
name = "CheckoutFailed",
133+
name : "CheckoutFailed",
124134
book_id = "12345",
125135
book_title = "Rust Programming Adventures",
126136
message = "Unable to process checkout."
@@ -137,10 +147,10 @@ fn benchmark_with_noop_layer(c: &mut Criterion, enabled: bool, bench_name: &str)
137147
c.bench_function(bench_name, |b| {
138148
b.iter(|| {
139149
error!(
140-
name = "CheckoutFailed",
150+
name : "CheckoutFailed",
141151
book_id = "12345",
142152
book_title = "Rust Programming Adventures",
143-
"Unable to process checkout."
153+
message = "Unable to process checkout."
144154
);
145155
});
146156
});

0 commit comments

Comments
 (0)