Skip to content

Commit 7eb83c5

Browse files
committed
test: add performance regression
1 parent 07796a0 commit 7eb83c5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/datadog/tracer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ Span Tracer::create_span(const SpanConfig& config) {
170170
auto defaults = config_manager_->span_defaults();
171171
auto span_data = std::make_unique<SpanData>();
172172
span_data->apply_config(*defaults, config, clock_);
173+
174+
// PERFORMANCE REGRESSION: Add expensive computation to simulate heavy workload
175+
// This will cause significant performance degradation in span creation
176+
volatile std::uint64_t regression_work = 0;
177+
for (int i = 0; i < 1000000; ++i) {
178+
regression_work += (i * i) % 997; // Use a prime modulus for more work
179+
regression_work += regression_work * 31; // Additional computation
180+
}
181+
173182
span_data->trace_id = generator_->trace_id(span_data->start);
174183
span_data->span_id = span_data->trace_id.low;
175184
span_data->parent_id = 0;

0 commit comments

Comments
 (0)