Skip to content

Commit 36cbe8d

Browse files
authored
test: Modify perf tests to pass event name correctly to avoid string allocation (#2762)
1 parent f013b3d commit 36cbe8d

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

opentelemetry-appender-tracing/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
});

stress/src/logs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
~31 M/sec
77
88
Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs,
9-
~40 M /sec
9+
~44 M /sec
1010
1111
Hardware: Apple M4 Pro
1212
Total Number of Cores: 14 (10 performance and 4 efficiency)
13-
~40 M/sec
13+
~50 M/sec
1414
~1.1 B/sec (when disabled)
1515
*/
1616

@@ -88,7 +88,7 @@ fn main() {
8888

8989
fn test_log() {
9090
error!(
91-
name = "CheckoutFailed",
91+
name : "CheckoutFailed",
9292
book_id = "12345",
9393
book_title = "Rust Programming Adventures",
9494
message = "Unable to process checkout."

0 commit comments

Comments
 (0)