[Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

Zachary Ware zachary.ware+pytut at gmail.com
Tue Jul 30 13:04:08 EDT 2019


On Tue, Jul 30, 2019 at 11:24 AM boB Stepp <robertvstepp at gmail.com> wrote:
> In this trivial example I cannot imagine there is any realistic
> difference between the two approaches, but I am trying to generalize
> my thoughts for potentially much more expensive calculations, very
> large data sets, and what is the likelihood of storage errors
> occurring in files.  Any thoughts on this?

As with many things in programming, it comes down to how much time you
want to trade for space.  If you have a lot of space and not much
time, store the calculated values.  If you have a lot of time (or the
calculation time is negligible) and not much space, recalculate every
time.  If you have plenty of both, store it and recalculate it anyway
:).  Storing the information can also be useful for offline debugging.

-- 
Zach


More information about the Tutor mailing list