Live data from Hacker News

Ruby Under a Microscope: Learning Ruby Internals through Experiment

patshaughnessy.net

31–40 of 40 posts

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#31
post #15
post #14

Earlier quoted context omitted.

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.

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#33

Earlier quoted context omitted.

The code for MRI is.. idiomatic, but actually pretty easy to read. I last did C full time in the 90s and so am mostly just a 'reader' now but it's not hard to follow, although some of the reasoning behind doing things a certain way in MRI is unfathomable.. ;-)

I don't understand the wording of your first sentence. Did you mean "idiotic" or?

[deleted]

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#34

Earlier quoted context omitted.

I'd usually agree with a comment like this but in this case, it has so many (useful) color diagrams that while it wouldn't be impossible to put on the Kindle, I don't think you'd get an amazing experience. Could be wrong though!

Since kindle fire, the books can be posted in colors :)

That's true, but I suspect the vast majority of Kindle users and buyers are stuck on 6" greyscale screens which aren't great for diagrams or code without a lot of care. "Source code looks horrible on the Kindle edition!" is one of the most common complaints I've seen on Kindle books so far, but it's definitely getting better.

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#35

Earlier quoted context omitted.

The code for MRI is.. idiomatic, but actually pretty easy to read. I last did C full time in the 90s and so am mostly just a 'reader' now but it's not hard to follow, although some of the reasoning behind doing things a certain way in MRI is unfathomable.. ;-)

I don't understand the wording of your first sentence. Did you mean "idiotic" or?

Pat probably meant 'idiosyncratic' instead of 'idiomatic' (unless it's a non-idiomatic use of 'idiomatic').

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#36

Earlier quoted context omitted.

I don't understand the wording of your first sentence. Did you mean "idiotic" or?

Pat probably meant 'idiosyncratic' instead of 'idiomatic' (unless it's a non-idiomatic use of 'idiomatic').

'Idiosyncratic' is clearer, though 'idiomatic' is valid and what I wished to say, but in its secondary definition: http://www.merriam-webster.com/dictionary/idiomatic (see def 2)

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#37
post #31
post #15

Earlier quoted context omitted.

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 par…

Thank you!

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#38

Earlier quoted context omitted.

I don't understand the wording of your first sentence. Did you mean "idiotic" or?

https://encrypted.google.com/search?q=define%3Aidiom

Yes, thanks. I know what idiomatic means, but the OP either does not or just wrote an awkward sentence.

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#39

Earlier quoted context omitted.

Pat probably meant 'idiosyncratic' instead of 'idiomatic' (unless it's a non-idiomatic use of 'idiomatic').

'Idiosyncratic' is clearer, though 'idiomatic' is valid and what I wished to say, but in its secondary definition: http://www.merriam-webster.com/dictionary/idiomatic (see def 2)

Oh, OK. I've never seen "idiomatic" used with a negative connotation before.

Re: Ruby Under a Microscope: Learning Ruby Internals through Experiment

#40

Earlier quoted context omitted.

'Idiosyncratic' is clearer, though 'idiomatic' is valid and what I wished to say, but in its secondary definition: http://www.merriam-webster.com/dictionary/idiomatic (see def 2)

Oh, OK. I've never seen "idiomatic" used with a negative connotation before.

[deleted]
Post reply on HN