Sha256: d104abca35960c2200a8a27b3247433495abbad8ea24954832745142ddf6de8a

Contents?: true

Size: 693 Bytes

Versions: 3

Compression:

Stored size: 693 Bytes

Contents

#!/opt/local/bin/ruby

require 'environment'
require 'ruby-prof'

# RubyProf, making profiling Ruby pretty since 1899!
def profile(&b)
  result = RubyProf.profile &b

  printer = RubyProf::GraphHtmlPrinter.new(result)
  File::open('profile_results.html', 'w+') do |file|
    printer.print(file, 0)
  end
end

profile do
  1000.times do
    Zoo.all.each { |zoo| zoo.name; zoo.exhibits.entries }
  end
end

puts "Done!"

# require 'benchmark'
# 
# N = 100_000
# 
# Benchmark::bmbm do |x|
#   x.report do
#     N.times do
#       Inflector.underscore('DataMapper')
#     end    
#   end
# 
#   x.report do
#     N.times do
#       String::memoized_underscore('DataMapper')
#     end
#   end
# end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datamapper-0.3.1 profile_data_mapper.rb
datamapper-0.3.2 profile_data_mapper.rb
datamapper-0.3.0 profile_data_mapper.rb