Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Created May 9, 2016 23:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenderlove/9ea76c0274812b477f32e4a542a97f82 to your computer and use it in GitHub Desktop.
Save tenderlove/9ea76c0274812b477f32e4a542a97f82 to your computer and use it in GitHub Desktop.
#$null_stream = $stdout
$null_stream = File.open(File::NULL, 'w')
require 'rspec'
def start_runner
RSpec::Core::Runner.run [], $null_stream, $null_stream
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
expect(true).to be
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