Optimizing MemoWise Performance

There’s a new gem in town! It’s a memoization gem called MemoWise (pun very much intended) and we think it’s the best way to memoize methods in Ruby. This post covers how we made it so fast, and you can also read our other posts about its origin story and some advanced Ruby tricks we learned along the way.Benchmark Driven DevelopmentWe began by writing benchmark code for our gem so that at any time we could see how performant it was. We decided to explicitly optimize for memoized value retrieval, so our benchmarks only test the speed at which an already-memoized method’s results are returned on subsequent method calls. Because we memoize many different methods in our codebase, we also ensured our benchmarks cover many parameter types and combinations—from def method1 to def method2(a, *b, c:, **d).
Optimizing MemoWise Performance #ruby #rails #rubyonrails #bosnia #programming #tutorials #rubydeveloper #railsdeveloper

Nezir Zahirovic

Freelance software developer Ruby On Rails (6 years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles