Ruby Memoization and Alternatives
06-Dec-2018 1905
Memoization is often used when deriving values from other state on our objects. Saving derived state to an instance variable is a form of caching and comes with all the associated gotchas (cache invalidation!).Most of the time, this caching is a form of premature optimization. It’s often best to approach caching problems with a cost/benefit analysis. Caching has some upfront costs you always pay: extra complexity and cache invalidation. The desired benefit is to be able to skip some work.
Ruby Memoization and Alternatives #ruby #rubydeveloper #rubyonrails #Memoization #Alternatives https://rubyonrails.ba/link/ruby-memoization-and-alternatives