Profiling and optimizing your Python code | Python tricks

preview_player
Показать описание

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

Had to do a fast and superficial analysis in a very long code. This video made it possible, thanks a lot pal.

senajoaop
Автор

Good video, but it is actually quadratic (polynomial), not exponential. Quadratic is n^2, polynomial n^k, where k is a constant and exponential is k^n. n is length of input. You would not be able to do even near 5000 in exponential problem.

simonbrecher
Автор

Awesome video! Well explained, with a simple, clear and typical hands-on example illustration.
Great work.

Drahagoon
Автор

This channel needs a couple of millions subscribers... I always come back to it to learn those marvellous tips and tricks!

sheikhakbar
Автор

Great video!
here is another, perhaps easier, solution to make this code's complexity linear:
1. lowercase all the movies
2. convert your movie list into a set (sets in python avoid duplicates)
3. convert the set back into a list and return it.

eilonavizemer
Автор

i love the way you say "popping"

mervynwinn
Автор

Nice code optimization. specially the last one.

balmittal
Автор

It helped me a lot in tracking expensive functions that were unnecessary used 2 million times in a loop. Thanks for this useful tutorial!

mstr_rprochowicz
Автор

I came here to get a glimpse of how cProfile module but leaving here impressed with your final solution...
I loved how you combined the zip() function after sorting the list...


And, a great job in illustrating the importance of why profilers are an important tool in a programmer's armamentarium...

MsSuyash
Автор

Man your videos are really really helpful! Best explanation of cProfile, profiling and optimization in python. Please keep posting videos...

MrAmbarish
Автор

Awesome video. It was great watching you go step by step through the ode optimization. Your solution for finding duplicates also was very clever and elegant. Worth a subscribe ^.^

legauk
Автор

Buddy this is Amazing, You should not be on such low subscriber count.. God bless

sailalmishra
Автор

This helped me optimize code by about 50-75% depending on the file contents being scanned. Earlier it was consuming about a minute on a large scan, while now it takes about 20 at max. The average speed is reduced to 10secs from 25secs. All I did after analyzing was change my Pandas Series objects (generated from Google Spreadsheets) to tuples (lists would also have the same effect but my data never changes in a single run).
Using cprofiler I could see that Pandas library was consuming loads of resources just to fetch values based on an index number. Thanks a ton!!

AyushMandowara_xx
Автор

In case anyone in the future reads this
I found that this method executes even faster than the method he ended up with.
from collections import Counter

def
return [movie for movie, count in Counter([movie.lower() for movie in read_movies(src)]).items() if count>1]

shivan
Автор

I initially subbed because of your Biological Psychology videos, but I didn't know you're into programming, very useful video!

sm_smo
Автор

Finally some optimization that is not too complex. Thanks.

prakharchaurasiya
Автор

15:30 auto corection !
Nice video BTW :D

Julien-hgjh
Автор

Great video and explanation. Thanks for sharing this.

vinitkumar
Автор

More more more videos. Yours video is very helpful! Keep going

versun
Автор

Good analysis and build up of improvements. Thanks!

ranelpadon