[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60860] Implementation of memoize
From: |
Guillaume |
Subject: |
[Octave-bug-tracker] [bug #60860] Implementation of memoize |
Date: |
Thu, 8 Jul 2021 05:00:44 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 |
Follow-up Comment #4, bug #60860 (project octave):
Thanks for testing. I don't think you do anything wrong. I see memoize more
useful for caching the output of lengthy computations (taking more time than
the caching overhead). You see something similar when running your example in
Matlab:
>> NN = 255; x = zeros(1,NN); tic; for i = 1:NN, x(i) = nonmemo(i); end;toc
Elapsed time is 0.004546 seconds.
>> NN = 1023; x = zeros(1,NN); tic; for i = 1:NN, x(i) = nonmemo(i);end;toc
Elapsed time is 0.005433 seconds.
>> NN = 255; x = zeros(1,NN); tic; for i = 1:NN, x(i) = memo(i); end;toc
Elapsed time is 0.090636 seconds.
>> NN = 1023; x = zeros(1,NN); tic; for i = 1:NN, x(i) = memo(i);end;toc
Elapsed time is 0.208253 seconds.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60860>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/