How to Speed Up Python Code with Threading [Tutorial]

Опубликовано: 01 Август 2023
на канале: Haseeb Kamal
1,534
50

Multithreading and multiprocessing allow computers to multitask and perform various tasks at the same time.
These concepts also help provide insane speedups to Python code.

In this video I will present the threading module in Python.
But first, I briefly explain threads, processes and the differences between parallelism and concurrency. Due to the global interpreter lock Python multithreading only achieves concurrency and not parallelism.

We look at some examples of how to speed up a Python program by using multiple threads. Finally, I also demonstrate through a code example how multithreading only leads to speed up in IO bound applications (and not CPU bound ones).

Source code:
https://github.com/mhkamal1/yt-conten...

00:00 intro
00:29 what are threads and processes?
01:12 client and server example
01:36 Global interpreter lock
01:55 parallelism vs. concurrency
03:53 Code: simple multithreading
05:30 Code: speed up with multithreading
07:16 Code: multithreading fails at CPU bound tasks
08:19 End

Please consider liking if you found the video useful and subscribe for more!

Subscribe here:    / @haseebkamal  


На этой странице сайта вы можете посмотреть видео онлайн How to Speed Up Python Code with Threading [Tutorial] длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Haseeb Kamal 01 Август 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,534 раз и оно понравилось 50 зрителям. Приятного просмотра!