Ruby / Rails Memoization Gems Memoist vs. Memoizable

I was just adding some memoization to a Rails app and I was exploring the available gems. I’d used Memoist in the past on another project but I couldn’t remember why I chose it over other gems.

While researching today I found the Memoizable gem and thought that it looked pretty good. It has all these nice badges on the GitHub page, like a CodeClimate score of 4.0. So I figured I’d go with Memoizable.

After installing it and memoizing some methods I realized why I went with Memoist in the past. Memoizable won’t let you memoize methods that take parameters. If you try to do so it will complain loudly with “Cannot memoize Class#method_name, its arity is 1”.

That was a non-starter for me. I switched to Memoist and all is well.

This entry was posted in Technology. Bookmark the permalink.