From: Peter Szinek Date: 2006-11-22T16:53:47+09:00 Subject: Re: Hpricot/Rubyful Soup comparison Wes Gamble wrote: > Has anyone done a head to head comparison of Hpricot and Rubyful Soup > (both HTML parsers)? > > If so, would you be willing to comment on which one a) is faster for an > average sized HTML page and I did not do any benchmarks, but I am scraping a lot of relatively big pages on a daily basis and I can tell you, RubyfulSoup is magnitudes slower than HPricot. I am absolutely sure about this. I am doing things with HPricot which should be extremely slow (e.g. traversing the whole tree and doing expensive operations on all Hpricot::Elements) yet HPricot is surprisingly fast. Rubyful is nowhere near. b) preserves the original HTML better. Hmm this I don't know, but I guess the term 'preserves HTML better' should be defined first with some metrics or something ( deviance from the HTML standard? ). There are a lot of so badly formed HTML pages, than even a human would come up with multiple solutions for their correction. I think the only real-life quality meter is to process your pages with both of them and see which one yields better results. I did not play too much with RubyfulSoup but I am writing a quite serious screen scraping framework based on Hpricot, and so far I had no real problems - and I am doing every kind of weird things. Cheers, Peter __ http://www.rubyrailways.com