Advertisement
Guest User

benchmark mechanize

a guest
Feb 12th, 2012
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.72 KB | None | 0 0
  1. require 'mechanize'
  2. require 'awesome_print'
  3. require 'benchmark'
  4.  
  5. @url = "http://www.walmart.com/ip/Hello-Kitty-Microfiber-Star-Kitty-Drapes/16775275?findingMethod=rr"
  6. agent = Mechanize.new
  7.  
  8. time = Benchmark.realtime do
  9.   page = agent.get(@url)
  10. end
  11. ap "1 - #{time}"
  12.  
  13. # agent = Mechanize.new
  14. @url = "http://www.walmart.com/ip/Hello-Kitty-Microfiber-Kitty-Me-Twin-Full-Bedding-Comforter/16775277"
  15. time = Benchmark.realtime do
  16.   page = agent.get(@url)
  17. end
  18. ap "2 - #{time}"
  19.  
  20. @url = "http://www.walmart.com/ip/Hello-Kitty-Bonjour-Kitty-Rug/16775276?findingMethod=rr"
  21. time = Benchmark.realtime do
  22.   page = agent.get(@url)
  23. end
  24. ap "3 - #{time}"
  25.  
  26.  
  27. # => "1 - 0.766310236"
  28. # => "2 - 0.966001185"
  29. # => "3 - 0.763668394"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement