Two scenarios:

  1. Function is called and data is computed and returned.
  2. Data is saved in variable, updated when required, data is retrieved from variable.

So I was wondering in what kind of scenarios one would be beneficial over the other?

  • $\begingroup$ For starters, how long does it take to compute the data? How often is that done, where is it used and by how many processes? Is there simultaneous access? Your second point brings us to databases and database theory. $\endgroup$
    – Juho
    Mar 17, 2021 at 11:45
  • 1
    $\begingroup$ Space–time tradeoff. $\endgroup$
    – Pål GD
    Mar 17, 2021 at 12:01


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.