Diagnose slow Python code. (Feat. async/await)

Diagnose slow Python code. (Feat. async/await)

mCoding

2 года назад

208,720 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

djtomoy
djtomoy - 14.10.2023 14:09

Just get some more ram or a bigger cpu

Ответить
Andrew's_Lab
Andrew's_Lab - 02.09.2023 17:12

There is no slow pyhon code.
It's just Python

Ответить
Evilonesw
Evilonesw - 05.06.2023 09:38

Easy, just dont use python. Only compiled languages are worth it

Ответить
The Welder
The Welder - 01.05.2023 23:12

Diagnose show Python code, really? It's Python, it's designed to be slow.

Ответить
Omena0
Omena0 - 27.04.2023 23:21

Bruh this didint help at all :(
Im already threading it...

Ответить
Chapeu de aluminio
Chapeu de aluminio - 31.03.2023 16:27

All python code is slow.

Ответить
Michael Magro
Michael Magro - 27.01.2023 02:36

Lançou a braba!

Ответить
Ray Horn
Ray Horn - 18.12.2022 21:58

I wanted to see a comparison of both versions of the errant function but that wasn't done.

Ответить
Bruno Cabral
Bruno Cabral - 12.12.2022 00:54

What are the advantages of SnakeViz over KCacheGrind?

Ответить
Trevor Tyrone
Trevor Tyrone - 13.11.2022 22:14

"I know it looks pretty simple " he says...

Ответить
Gero Zayas
Gero Zayas - 08.11.2022 01:00

Your channel is amazing! thanks a lot for such excellent and useful content!

Ответить
Anuar Lv
Anuar Lv - 04.11.2022 20:46

Great video thanks! What is the difference between running cProfile.Profile() vs cProfile.run()?

Ответить
Vishal Mishra
Vishal Mishra - 21.10.2022 12:42

Thank you for making such a high quality video. Amazing.

Ответить
Vadim Savitsky
Vadim Savitsky - 13.10.2022 02:18

Masterpiece! Thanks for your effort, I managed to get my hands to keyboard from other side of sofa just to write this comment.

Ответить
Helicopter Pilot
Helicopter Pilot - 12.10.2022 13:27

After running it with my project I've found out that 95% of the time is spent on ~:0(<method 'acquire' of '_thread.lock' objects>). I.e. it doesn't analyze the code run in the threads.

Ответить
Kyrylo Murashev
Kyrylo Murashev - 07.10.2022 22:36

There’s no such thing as fast python 🙂

Ответить
疯狂的大眼萌
疯狂的大眼萌 - 04.10.2022 05:25

Question: How to make a python program run faster
Answer: Rewrite that in basically any other language

Ответить
Youngz Production
Youngz Production - 01.10.2022 02:56

Nice tricks you put here. Thanks a lot.

Ответить
Voil
Voil - 25.09.2022 18:50

Yay my console application is now working with 1000+ FPS. My monitor is 60Hz so it doesnt really matter. I only needed 60 FPS.

Ответить
Chaz Mertes
Chaz Mertes - 18.09.2022 23:07

Thank you so much for contributing to the community in such a wonderful way!

Ответить
Joseph Lyons
Joseph Lyons - 05.09.2022 19:04

Does asyncio.gather() actually allow for them to complete in whatever order they complete in? I feel like in my testing, it blocks in the order of the tasks in the list. I know that asyncio.as_completed() was made for that purpose.

Ответить
Salahuddin Bangash
Salahuddin Bangash - 05.09.2022 10:24

whenever i see someone use perf_counter(), i find a CoreyMS student :).

Ответить
dante dt
dante dt - 16.08.2022 05:57

awesome

Ответить
Awli
Awli - 07.08.2022 16:36

All python is slow.

Ответить
한열
한열 - 30.07.2022 21:21

they seriously named it 'cumtime'?

Ответить
deemon710
deemon710 - 29.07.2022 02:19

Hm. So asyncio is good. I'm a little stuck understanding how that's not parallel processing as in different threads.

Ответить
Nick Heyer
Nick Heyer - 11.07.2022 05:28

So when this sends out an async request, it's like this?:

send request > check for response > send request > check for response > send request ...

instead of:

send request > wait for response > send request > wait for response ...

Ответить
Roman Petrov
Roman Petrov - 07.07.2022 20:15

Add threading or multiprocessing and boom 💥

Ответить
Syed Mokarrom Hossain
Syed Mokarrom Hossain - 17.06.2022 13:44

I always use threading using loop requests

Ответить
Vaclav Mecerod
Vaclav Mecerod - 17.06.2022 11:58

Thank you very much!!! Your advice helped me out!

Ответить
Kwe
Kwe - 16.06.2022 10:39

if you made a course I would buy it, you are amazing!

Ответить
Ben Long
Ben Long - 01.06.2022 12:42

This is a great video. Wow. Thanks!

Ответить
Hshhsj Hahsvs
Hshhsj Hahsvs - 01.06.2022 06:18

Liked and subscribed!! That was helpful

Ответить
A
A - 29.05.2022 12:57

Could you make a video explanining asynchronous and parallel programming technically? I see many others just give a broad overview of how to use the library, not explain what it does under the hood. Great content!

Ответить
Aeroniix
Aeroniix - 26.05.2022 16:51

very useful, thanks

Ответить
Fen
Fen - 23.05.2022 00:45

<3

Ответить
Jesus Albino
Jesus Albino - 11.05.2022 05:45

Man!
You create amazing content! Thanks for all.

Ответить
Ethan Kremer
Ethan Kremer - 27.04.2022 15:18

Hey there,have you heard of line_profiler? It's an amazing package that will document exactly how much time each line in your code takes. I use it similarly to these features, but it is far easier to implement. (Just import at the top and add a @profile decorator to any functions you want to be profiled)

Ответить
Phil Toa
Phil Toa - 26.04.2022 21:27

Nice.

Ответить
nitsanbh
nitsanbh - 26.04.2022 13:45

Opinion: JS has got its async/await much better & easier to use.
This is the equivalent JS code for the htmls:

const htmls = await Promise.all(
urls.map(async (url) => {
const res = await fefch(url);
return await res.text();
})
);

Ответить
Kieran Lynch
Kieran Lynch - 23.04.2022 19:43

lmao cumtime

Ответить
SavSamuShaman
SavSamuShaman - 30.03.2022 19:32

Marvelous :D

Ответить
Kaushik Chowdhury
Kaushik Chowdhury - 16.03.2022 10:08

Funny thing is, i made a project that does the 3n1 check for a long range of number, and save the step and result in a file... I wrote in both c++ and python, surprisingly python took half as much time... i guess python is better in writing optimized c++ code than me😅😅

Ответить
Moa Stevenson
Moa Stevenson - 03.03.2022 09:17

Brilliant! Thank you.

Ответить
:bunny:bunbob
:bunny:bunbob - 27.02.2022 20:24

you probably dont mention a critical thing. when i copy your code into my spyder it doesnt work and throws an error "AttributeError: __enter__" .

Ответить
Guillermo Alcantara Gonzalez
Guillermo Alcantara Gonzalez - 24.02.2022 18:15

Hey, Im curious. If you retrieve you URLs using map instead. Would that also take so long?

Ответить