class Benchkit::BenchmarkScript
Attributes
loop_count[R]
@return [Integer]
name[R]
@return [String]
Public Class Methods
new(name:, prelude: '', loop_count: nil, benchmark:)
click to toggle source
@param [String] name @param [String] prelude @param [String] benchmark
# File lib/benchkit.rb, line 119 def initialize(name:, prelude: '', loop_count: nil, benchmark:) @name = name @prelude = prelude @loop_count = loop_count @benchmark = benchmark end
Public Instance Methods
benchmark_script(iterations)
click to toggle source
# File lib/benchkit.rb, line 149 def benchmark_script(iterations) <<-RUBY #{@prelude} i = 0 while i < #{iterations} i += 1 #{@benchmark} end RUBY end
inherit_root(prelude:, loop_count:)
click to toggle source
# File lib/benchkit.rb, line 132 def inherit_root(prelude:, loop_count:) @prelude = "#{prelude}\n#{@prelude}" if @loop_count.nil? && loop_count @loop_count = loop_count end end
overhead_script(iterations)
click to toggle source
# File lib/benchkit.rb, line 139 def overhead_script(iterations) <<-RUBY #{@prelude} i = 0 while i < #{iterations} i += 1 end RUBY end