Hacker News new | past | comments | ask | show | jobs | submit login
Ruby 2.0 Works Hard So You Can Be Lazy (2013) (patshaughnessy.net)
63 points by thibaut_barrere on Dec 24, 2017 | hide | past | favorite | 11 comments



If you're interested in ruby and the upcoming ruby 2.5 release on Dec/25th - may I highlight the Ruby Advent Calendar 2017 [1] incl. Ruby 2.5 news and highlights 25 ruby libraries / gems. Happy holidays / christmas and hacking w/ ruby. [1]: https://planetruby.github.io/advent2017


I love this thing that Ruby publishes a new release on Christmas. I usually don't like Christmas, but this is an appreciated present.


Relevant to Python 3 as well: a lot of methods has updated to use iterators when they can making the lazy and much more efficient


Iterators on small lists aren't always more efficient.


Needlessly pedantic


Why? It's true, and useful to know if we are talking about efficiency.


And in most programs, lists ARE small quite often.


Hence the first lazy evaluation example becomes something like

  import itertools
  list(itertools.islice(itertools.count(),10))
Though perhaps there is a more elegant (if not more efficient) way to do this?


Does optimizing Ruby have diminishing returns? It doesn't have a JIT and it's all late method lookups, seems like that would be a much higher performance win, to remove the runtime metaprogrammed nightmare soup. I also wonder if that's even compatible with the language at all.


Would be nice to have an implementation in pure ruby of this to play around with. In the meantime it's good the article is well illustrated.


No tax breaks for Ruby.




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

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

Search: