4 ms·
(IncPy author here ...) yup agreed, but the programmer needs to figure out: 1.) when it's safe to memoize 2.) when it's worthwhile to memoize also, your mem
by pgbovine 16y ago
(IncPy author here ...)
yup agreed, but the programmer needs to figure out:
1.) when it's safe to memoize
2.) when it's worthwhile to memoize
also, your memoization decorator doesn't save data to disk. if you wrote a persistent memoizer, then you would need to also track all dependencies for the data you memoized, so that you can know when it's safe to invalidate on-disk cache entries.
IncPy takes care of all of this automatically ;)
- newtonapple 16y agoI have a question. How does IncPy keep track of data dependency coming from IO layer e.g. sockets. Say I want to write a simple web crawler. The function crawls a website, spits out the HTML in raw string, sleeps for 5 seconds and then crawls the site again. Will IncPy not memoize the function at all, knows that the data coming from the network layer has not changed and return the memoized string immediately, and/or smart enough to detect when input (the website) has changed and expires the cache automatically?
- ippisl 16y agoincPy need checks the functions it caches to be pure and determinstic. determinstic function is a function that when given the same input , always returns the same output. incPy tests for a few options of non-determinism , and will allow in the future to define non determinstic sources in a config file.