Hacker News new | past | comments | ask | show | jobs | submit login

It's just raining amazing Ruby books lately. Last week there was Working With TCP Sockets and now this. I'm having trouble finding time for them all :).



Cool, I just bought Ruby Under a Microscope and then looked up http://workingwithtcpsockets.com/ to buy that book, too.

I'm at a point in my Ruby career where I've begun peeking under all the abstractions I use after hitting performance bottlenecks. Performance has even led me to all sorts of new tools like using a SAX XML parser (using the Ox gem) instead of trying to walk the XML DOM in memory with Nokogiri.


Just out of curiosity:

Nokogiri has SAX capabilities as well (http://nokogiri.org/Nokogiri/XML/SAX/Document.html). Any reason not to use them, especially as Nokogiri also has native JRuby support?


It was just for fun. Both SAX APIs are sorta nebulous as it is to someone like me who's been so used to an abundance of tutorials on the tools I regularly use. Ox's SAX API was better, though.

I had just wanted to speed up my XML parser and stumbled upon a Nokogiri vs Ox benchmark (http://www.ohler.com/dev/xml_with_ruby/xml_with_ruby.html). So I tried Ox.

Here's my effort to benchmark Nokogiri vs Ox, DOM vs SAX parsing on an 80mb XML file with 38k nodes: https://gist.github.com/3977120

    Ox DOM: 6 seconds (550mb)
    Ox SAX: 6 seconds (12mb)
    Nokogiri DOM: 13 seconds (900mb)
    Nokogiri SAX: 24 seconds (11.8mb)
I'm no benchmarking wizard, though.


Thank you!




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: