Sha256: ed506a54366255a9d9376b291f27d75552bee6a3ce320b5294f4cc2497ea9c1a
Contents?: true
Size: 749 Bytes
Versions: 16
Compression:
Stored size: 749 Bytes
Contents
# frozen_string_literal: true require "rubygems" require "benchmark" require "stackprof" require_relative "cache_runner" RUNS = 1000 def run(obj, filename: nil) puts "#{obj.class.name}:" obj.prepare data = StackProf.run(mode: :cpu) do obj.run end StackProf::Report.new(data).print_text(false, 20) File.write(filename, Marshal.dump(data)) if filename puts ensure obj.cleanup end create_database(RUNS) if (runner_name = ENV["RUNNER"]) if (runner = CACHE_RUNNERS.find { |r| r.name == runner_name }) run(runner.new(RUNS), filename: ENV["FILENAME"]) else puts "Couldn't find cache runner #{runner_name.inspect}" exit(1) end else CACHE_RUNNERS.each do |cache_runner| run(cache_runner.new(RUNS)) end end
Version data entries
16 entries across 16 versions & 1 rubygems