Sha256: db8ac2662d615e2e9829e1a3aa82051a3e75f8fb328bbac655bc3e56c9068644

Contents?: true

Size: 676 Bytes

Versions: 5

Compression:

Stored size: 676 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
    database.query("SELECT * FROM zoos")
  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

5 entries across 5 versions & 1 rubygems

Version Path
datamapper-0.2.1 profile_data_mapper.rb
datamapper-0.2.2 profile_data_mapper.rb
datamapper-0.2.3 profile_data_mapper.rb
datamapper-0.2.4 profile_data_mapper.rb
datamapper-0.2.5 profile_data_mapper.rb