Add memoization to expensive pure functions because the library involves a lot of computation under the hood.