lib/benchmark_driver/runner/once.rb in benchmark_driver-0.13.0 vs lib/benchmark_driver/runner/once.rb in benchmark_driver-0.13.1

- old
+ new

@@ -49,11 +49,11 @@ # @param [BenchmarkDriver::Runner::Ips::Job] job - loop_count is not nil # @param [BenchmarkDriver::Context] context # @return [Float] duration def run_benchmark(job, context:) benchmark = BenchmarkScript.new( - prelude: "#{context.prelude}\n#{job.prelude}", + preludes: [context.prelude, job.prelude], script: job.script, teardown: job.teardown, loop_count: job.loop_count, ) @@ -88,12 +88,13 @@ # @param [String] prelude # @param [String] script # @param [String] teardown # @param [Integer] loop_count - BenchmarkScript = ::BenchmarkDriver::Struct.new(:prelude, :script, :teardown, :loop_count) do + BenchmarkScript = ::BenchmarkDriver::Struct.new(:preludes, :script, :teardown, :loop_count) do # @param [String] result - A file to write result def render(result:) + prelude = preludes.reject(&:nil?).reject(&:empty?).join("\n") <<-RUBY #{prelude} __bmdv_before = Time.now #{script} __bmdv_after = Time.now