Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark for TraceDigest generation #3475

Merged
merged 3 commits into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions benchmarks/tracing_trace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ def trace(x, depth)
x.compare!
end
end

def benchmark_to_digest
Datadog::Tracing.trace('op.name') do |span, trace|
Benchmark.ips do |x|
benchmark_time = VALIDATE_BENCHMARK_MODE ? { time: 0.001, warmup: 0 } : { time: 10.5, warmup: 2 }
x.config(**benchmark_time)

x.report("trace.to_digest") do
trace.to_digest
end

x.save! "#{__FILE__}-results.json" unless VALIDATE_BENCHMARK_MODE
x.compare!
end
end
end
end

puts "Current pid is #{Process.pid}"
Expand All @@ -81,4 +97,5 @@ def run_benchmark(&block)
TracingTraceBenchmark.new.instance_exec do
run_benchmark { benchmark_no_writer }
run_benchmark { benchmark_no_network }
run_benchmark { benchmark_to_digest }
end
Loading