What is the difference between Caching and Memoization?

后端 未结 5 704
南方客
南方客 2021-01-30 15:17

I would like to know what the actual difference between caching and memoization is.
As I see it, both involve avoiding repeated function ca

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-30 15:59

    As I have seen them used, "memoization" is "caching the result of a deterministic function" that can be reproduced at any time given the same function and inputs.

    "Caching" includes basically any output-buffering strategy, whether or not the source value is reproducible at a given time. In fact, caching is also used to refer to input buffering strategies, such as the write-cache on a disk or memory. So it is a much more general term.

提交回复
热议问题