Skip to content

Instantly share code, notes, and snippets.

@lokeshh
Created August 9, 2016 20:27
Show Gist options
  • Select an option

  • Save lokeshh/509457f6e7bc095fdef665ff044fcbe4 to your computer and use it in GitHub Desktop.

Select an option

Save lokeshh/509457f6e7bc095fdef665ff044fcbe4 to your computer and use it in GitHub Desktop.
require 'ruby-prof'
n = 100000
dv = Daru::Vector.new 1..n
RubyProf.start
100.times { dv.reject_values nil }
result = RubyProf.stop
printer = RubyProf::GraphHtmlPrinter.new(result)
printer.print(File.open('cache.html', 'w'))
require 'ruby-prof'
n = 100000
dv = Daru::Vector.new 1..n
RubyProf.start
100.times { dv.reject_values nil }
result = RubyProf.stop
printer = RubyProf::GraphHtmlPrinter.new(result)
printer.print(File.open('without_cache.html', 'w'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment