Paul schreef op do 09-02-2012 om 19:21 [-0500]:
But how does memoization improve on the concept that all functions are|can be cached in a more "classic" manner (as can be mysql and possibly zebra.) The concept of memoization is to eliminate *repetitivity* (classic case; memoize 17! and calculating either 15! or 19! reduces to 2 operations.)
Well, the definition is slightly different but closely related. More or less, it can be used as a fancy way of saying "caching function results." Assume that every request for a syspref goes to the database, if we replace that with something that does it once and caches it, then that's giving us something that will speed up every operation requiring that syspref (and while composing many pages, I expect that the same syspref is hit a good number of times.) However, in the Perl world anyway, it's made quite invisible. This is a Perl module commonly used for this: http://perldoc.perl.org/Memoize.html and it actually uses recursive maths functions as examples, but the approach can generalise to other things. Mostly to speed up slow, repetitive data accesses. -- Robin Sheat Catalyst IT Ltd. ✆ +64 4 803 2204 GPG: 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D