Open wan54 opened 7 years ago
@wan54 your example seems incomplete. Can you provide a complete test case, that exposes eventual issue?
In what you've shown, many things can happen.. e.g. external module may call exportedFn
few times, while setInterval
will clear cache only to last one generated.
You're right. It's because only the last one the issue. I'm clearing as soon as fn() finishes. Thanks.
Is it expected though that the next fn invocation increases the Initial hit size
1. fn() call
Init Cache %Cache
864 622 41.86
2. fn.clear()
3. fn() call
Init Cache %Cache
1641 1167 41.56
4. fn.clear()
5. fn() call
Init Cache %Cache
2418 1712 41.45
With clear
you clear the cache totally, and you go back to initial state, so it's normal that next invocations will produce similar profile output as first one. Unless I don't understand something (?)
I was questioning why the initial hit increases in the subsequent clear and call.
On 16 Mar 2017, at 18:17, Mariusz Nowak notifications@github.com wrote:
With clear you clear the cache totally, and you go back to initial state, so it's normal that next invocations will produce similar profile output as first one. Unless I don't understand something (?)
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.
@wan54 you mean, why counter was not reset after clear?
The profile functionality is global, it covers all memoized functions registered in a process, and doesn't have any reset counter function. Would you like to see it? I think it makes sense to add it
Yes that'd be great. Thanks.
On 17 Mar 2017, at 19:26, Mariusz Nowak notifications@github.com wrote:
@wan54 you mean, why counter was not reset after clear?
The profile functionality is global, it covers all memoized functions registered in a process, and doesn't have any reset counter function. Would you like to see it? I think it makes sense to add it
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Yes that'd be great. Thanks.
Ok Iet's make this issue about that. I'll leave it open until it's addressed
EDIT: This issue originally was false bug report, but ended as a request for ability to reset profile numbers
calling clear() on a memoized function doesn't seem to work.
example:
any ideas why clear() does not have any effect?
Thanks