Skip to content

Instantly share code, notes, and snippets.

@nebuta
Created December 16, 2012 11:24
Show Gist options
  • 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