RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Methods To Remember Things By: Ruby Memoization

No Rubyist wants to make expensive, time-consuming method calls more than they have to. Thankfully, using memoization means that we don’t have to (well, at least, not as often). This blog post covers the history behind memoization, its implementation, and its controversial history in the Rails source code.

Comments

One thing you forgot to talk about is memoizing results of methods that receive arguments. Gems like memoist allow that out of the box, while you have to use some cryptic hash techniques if you stick to normal instance variable memoizing.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in