Python GC Settings - Change This and Go 20% Faster!

  Рет қаралды 5,992

Michael Kennedy

Michael Kennedy

Күн бұрын

Пікірлер: 18
@daincrawford8439
@daincrawford8439 2 жыл бұрын
Just ran this on one of my scripts with the three lines added. 5 min .3 sec before and 4 min 17.9 sec after. That is amazing.
@mikeckennedy
@mikeckennedy 2 жыл бұрын
Dain, that is awesome. Thanks for sharing your findings.
@mrmagnetic927
@mrmagnetic927 2 жыл бұрын
Always a big fan of Mike and these amazing videos. I learn so much in this space
@mikeckennedy
@mikeckennedy 2 жыл бұрын
Thanks so much :)
@jeanchristophe15
@jeanchristophe15 2 жыл бұрын
Awesome video Michael! Thank you!
@r-tierney
@r-tierney 2 жыл бұрын
Nice one! I'll definitely be trying this out. One small thing I'd probably recommend using time.monotonic() to avoid time drift due to NTP / daylight savings etc. when measuring this kind of stuff.
@MakeDataUseful
@MakeDataUseful 2 жыл бұрын
Thanks for the share Michael, I have some very long running data pipelines that I think could benefit from this.
@mikeckennedy
@mikeckennedy 2 жыл бұрын
You're welcome! Let us know how it turns out.
@elev007
@elev007 2 жыл бұрын
Thanks Michael!
@christophertyler1882
@christophertyler1882 2 жыл бұрын
I have to give this a try. A lot of my data does come from a database but I tend to put into a Pandas dataframe.
@mikeckennedy
@mikeckennedy 2 жыл бұрын
Excellent. Please report back on whether it makes a difference for you (positive or negative). It's one of those your milage may vary things. With Pandas, the data is in C and outside the GC's purview so it might matter less.
@blazkowicz666
@blazkowicz666 10 ай бұрын
Is this valid for python 3.11+?
@topcivilian
@topcivilian Жыл бұрын
Why aren't the memory settings optimized by default?
@qozia1370
@qozia1370 Жыл бұрын
thank you
@jamesfitzpatrick9607
@jamesfitzpatrick9607 2 жыл бұрын
A question I need to ask is why are those numbers so low?
@mikeckennedy
@mikeckennedy 2 жыл бұрын
What numbers are you talking about specifically? And what are you comparing them to?
@jamesfitzpatrick9607
@jamesfitzpatrick9607 2 жыл бұрын
@@mikeckennedy kinda all the numbers but mainly the 700. With thinking about this a bit sense I guess this could be a bit of a historical number. On older machines with lower memory, higher numbers could cause problems. So using a 50,000 could be costly. I am now wondering if those numbers will be changed by default in the future as python is trying to make performance improvements.
@mikeckennedy
@mikeckennedy 2 жыл бұрын
@@jamesfitzpatrick9607 I see. It's interesting that it's 700. That seems insanely low to me. I bet you're right that in 1991 that made sense. It doesn't now. Plus, the thing to keep in mind is that it *only* applies to cycles that are missed by ref counting. Ref counting runs first, then if there are cycles that would have leaked, then the GC kicks in. For 95% of apps, that almost never happens. I'm glad they make it configurable.
2.4 - Garbage Collection in Python
26:40
Key2Learn
Рет қаралды 9 М.
Garbage Collection (Mark & Sweep) - Computerphile
16:22
Computerphile
Рет қаралды 248 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 16 МЛН
You Are WRONG About 0 Based Indexing
25:02
ThePrimeTime
Рет қаралды 295 М.
17x Faster Page Load in 30 minutes using Python, PyCharm, and MongoDB
28:19
Memory Management in Python - The Basics
30:27
North Bay Python
Рет қаралды 36 М.
Writing Faster Python 3 - presented by Sebastian Witowski
42:05
EuroPython Conference
Рет қаралды 17 М.
Metaclasses in Python
15:45
mCoding
Рет қаралды 157 М.
python: what is weakref? (intermediate - advanced) anthony explains #366
10:40