Created
May 9, 2016 23:30
-
-
Save tenderlove/a9d91058abff47480c4deec322cb32d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#$null_stream = $stdout | |
$null_stream = File.open(File::NULL, 'w') | |
if defined? Minitest | |
RSpec = Minitest::Spec | |
module Minitest | |
class << self | |
alias :old_process_args :process_args | |
def process_args *args | |
options = old_process_args(*args) | |
options[:io] = $null_stream | |
options | |
end | |
end | |
end | |
def start_runner | |
Minitest.run [] | |
end | |
else | |
require 'rspec' | |
def start_runner | |
RSpec::Core::Runner.run [], $null_stream, $null_stream | |
end | |
end | |
tp = TracePoint.new(:inline_cache_hit, :inline_cache_miss) do |x| | |
p x.event | |
end | |
RSpec.send :describe, "foo" do | |
N = (ENV['N'] || 100).to_i.times do |x| | |
it "foo #{x.to_s}" do | |
end | |
end | |
end | |
#start = Process.clock_gettime Process::CLOCK_MONOTONIC, :microsecond | |
tp.enable | |
start_runner | |
tp.disable | |
#p Process.clock_gettime(Process::CLOCK_MONOTONIC, :microsecond) - start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment