[plt-scheme] Unexpected slowdown using memoized function
>>>>> "Grant" == Grant Rettke <grettke at acm.org> writes:
Grant> 381 took 23 seconds 383 took 39 seconds
The only thing I can think of is that you're calling P with lots of
distinct values -- i.e., you're doing
(P 10)
(P 9893)
(P 33)
...
and no two values are the same. Obviously if you don't call P with
the same values more than once, you get no benefit from memoization;
and also obviously memoization has _some_ cost (namely, the memory to
store all the inputs and outputs).
--
[T]he only two jobs at which I have ever earned my living are
soul musician and linguist
Geoffrey K. Pullum