Let's say you have a function that is a super-slow function. Not sure how you can find which is a super slow function? Measure it with this. Now there is now way you can optimize the function, what you can do instead is that you can store results fro...

Markdown supported · ⌘↵ to post
The built in caching function has a limited storage space and unused cached elements are evicted with LRU policy. As both uses a dictionary to store the data cache access time would be same O(1) constant
Sébastien Portebois
Software architect at Ubisoft
Did you try timing it against the built-in cache functions Python provides?
eg docs.python.org/3/library/functools.html
It’s indeed a good way to introduce how to create custom decorators, but for this caching purpose, I’d believe the built-in implementation will be faster.