Closed luisfabib closed 4 years ago
I tried making the cache
, stack
, and DeerLab_path
persistent variables to avoid their repeated evaluation. With stack
it is not possible as the function is dependent on the internal state of MATLAB and cannot be memoized or cached. While this changes considerably reduce the self time of parseoptions
it still remains the bottleneck of fitsignal
.
We might need to drop this options design, and return to a less sophisticated but faster one.
I agree. It's both too complicated and too slow. Easiest if each function just looks for the name-value pairs it needs and then ignores all others.
Closed with d53a2be
After the recent re-design of
fitsignal
(47cb48a), while running the corresponding tests I realized that the performance had dropped dramatically. Here is an example of the performance drop found for a simple test such asfitsignal_4pdeer
Before
Now
Profiling the test run clearly shows that the bottleneck is the
parseoptions
function, especially the call todbstack
,which
andload
functions. This is unacceptable as theparseoptions
should at most run for 1s (if even). The reason why this was not detected while implemening this was that the runtime is not that dramatic for single-call functions. However, in the case offitsignal
, it internally callsdipolarkernel>dipolarbackground
inside the model function which is evaluated by the solver. Therefore,parseoptions
is called over 20k times leading to the performance drop.