What is the best memoization library?

This page summarizes the projects mentioned and recommended in the original post on /r/typescript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • moize

    The consistently-fast, complete memoization solution for JS

  • I recently did some testing on the most popular memoization libraries and found moize to be the most fully-featured, actively maintained, and performant.

  • micro-memoize

    A tiny, crazy fast memoization library for the 95% use-case

  • The author has also published a bare-bones version called micro-memoize. If you care about bundle size and don't need any bells and whistles, this is likely your best bet. If you do end up going that route, watch out for the default maxSize of 1, meaning unless you specify otherwise, it will only store the most recent result in the cache.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • just

    A library of dependency-free JavaScript utilities that do just one thing. (by angus-c)

  • If the code should, as you say, be 5 lines, why take on a dependency at all? By doing so, you end up with a catch-all solution that does almost nothing other than JSON.stringify your args, which is extremely poorly optimized to handle many situations, e.g. one of your args is a primitive and the other is a large config object.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts