---
title: "Comment by Sébastien Portebois on \"Speed up your python code by caching\" | Hashnode"
description: "Did you try timing it against the built-in cache functions Python provides? eg https://docs.python.org/3/library/functools.html It’s indeed a good way to introd"
url: "https://hashnode.com/posts/cache-your-code/5fe703346a146422083cd0e7/comment/5fe7cd976a146422083cdaff"
---

[Discussion](https://hashnode.com/posts/cache-your-code/5fe703346a146422083cd0e7)

Comment [Speed up your python code by caching](https://hashnode.com/posts/cache-your-code/5fe703346a146422083cd0e7)

[Sébastien Portebois](https://hashnode.com/@sportebois)

[Dec 26, 2020](https://hashnode.com/posts/cache-your-code/5fe703346a146422083cd0e7/comment/5fe7cd976a146422083cdaff)

Did you try timing it against the built-in cache functions Python provides?

eg [docs.python.org/3/library/functools.html](https://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.

[theroyakash](https://hashnode.com/@theroyakash)

[Dec 27, 2020](https://hashnode.com/posts/cache-your-code/5fe703346a146422083cd0e7/comment/5fe7cd976a146422083cdaff#reply-5fe85bb4999b3f21e31585c5)

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
