Last active
December 11, 2015 04:29
-
-
Save apotonick/4545761 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xml = "<bla>" + | |
10000.times.collect { "<item />" }.join("") + | |
"</bla>" | |
puts( "elapsed time (xpath): " + Benchmark.realtime do | |
Nokogiri::XML(xml).root.search("./item") | |
end.to_s) | |
puts( "elapsed time: " + Benchmark.realtime do | |
Nokogiri::XML(xml).root.children.find_all do |cld| | |
cld.name == "item" | |
end | |
end.to_s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment