Skip to content

Commit

Permalink
Merge pull request #3475 from DataDog/bm-digest
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Feb 23, 2024
2 parents dc2698d + a72e37b commit d25ae75
Showing 1 changed file with 17 additions and 0 deletions.
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

0 comments on commit d25ae75

Please sign in to comment.