Speeding Up Python Code With Caching

preview_player
Показать описание
Today we learn how to speed up Python code using caching.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

🌐 Social Media & Contact 🌐

Рекомендации по теме
Комментарии
Автор

ahh... lemme cache my hello world program now

SparePlayss
Автор

I just found out that the cache decorator was added in Python version 3.9, so those who are in a previous version have to use lru_cache instead.

ikki
Автор

You can increase the recursion limit using sys module

import sys
sys.setrecursionlimit(10**12)

zombiekiller
Автор

Me: "How do I do caching in python... I bet there's a module for this."
NeuralNine: "yeah 'from functools import cache' "
Perfect video, it's rare that you get the exact answer you are looking for with a walk through right away. I love the future!

leifleoden
Автор

When caching is used in calculations like this the technique is often called 'memoization'. Also quite handy when writing a prime factor sieve. Love the channel. Long live human 2.0. Go SpaceX.

thomasgoodwin
Автор

Thank you for this sir! (Watching from Philippines)

pandasleaf
Автор

Actually learned so much from this. Decorators finally make sense and I found a way to speed up my python programs

Thokpower
Автор

More of this content please !!
actual real life use-full things
thank you for the hard-work

mohamedhabas
Автор

Loved your intro music!





The video as well. You're awesome and unique as always :)

akshatdodhiya
Автор

When recommendation is faster than notification

switchblade
Автор

amazing video and content. Straight to the point.

rugmaable
Автор

This is awesome! Learned much about it!

Manishdna
Автор

this cache is similar to the idea of dynamic - save some part of the result

phinguyen
Автор

Thank u, and is there anyway u could make a video on Cython, Numba, or any other library helping speed ups?

MrRezhes
Автор

my python 3.9 functools dont have @cache anymore i think, i get an error whereas @lru_cache works

gerokatseros
Автор

awesome toturial, thanks.
but can we know how the cache function acts or not, and can we write a normal function acts like a built-in cache function.

learntocode
Автор

I had already tried to import cache from functool in google colab but it got an error, do you know why this happens? So instead i import Cache from cache-decorator

rizkyagungshahputra
Автор

When I saw it I just hoped that it wasn’t an april fools

mr.lawliet
Автор

for me it isnt working. with cache and without cache always shows same time idk why

cagataydemirbas
Автор

Caching data basically means you're decreasing the amount of calculations you need to do by optimizing the process through which the calculations are done.
But heres what im confused about.
Why does caching make it THAT much faster? Here you're decreasing the number of calculations u need to do by half (or is that more than half) so why is it so significantly faster
Found my answer. The decrease in calculations is significantly more than half.
The Fibonacci sequence is super unoptimized

GodbornNoven