Skip to content

Instantly share code, notes, and snippets.

@nebuta
Created December 16, 2012 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nebuta/4306454 to your computer and use it in GitHub Desktop.
Save nebuta/4306454 to your computer and use it in GitHub Desktop.
Ruby scraping benchmark code
require 'rubygems'
require 'nokogiri'
require 'open-uri'
10.times do
doc = Nokogiri::HTML(open("http://www.w3.org/html/wg/drafts/html/master/single-page.html"))
puts(doc.css("ul > li").length.to_s + " elements.")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment