From 73855e6428d1a0ba06b413b25f98ddf181bbc391 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 21 May 2015 20:59:48 +0200 Subject: [PATCH] Compare with Nokogiri in the HTML parser bench --- benchmark/xml/parser/html_bench.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/benchmark/xml/parser/html_bench.rb b/benchmark/xml/parser/html_bench.rb index 5e28983..9637784 100644 --- a/benchmark/xml/parser/html_bench.rb +++ b/benchmark/xml/parser/html_bench.rb @@ -1,9 +1,17 @@ require_relative '../../benchmark_helper' +require 'nokogiri' + html = read_html Benchmark.ips do |bench| - bench.report 'parse HTML' do - Oga::HTML::Parser.new(html).parse + bench.report 'Oga' do + Oga.parse_html(html) end + + bench.report 'Nokogiri' do + Nokogiri::HTML(html) + end + + bench.compare! end