Improving Python performance with multiprocessing | Python tricks

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • [www.buymeacoff...] A basic introduction into multiprocessing with Python. I first describe what multiprocessing is, and when to use it, and then I show how to use the multiprocessing.Pool() object. You can view the code here: osf.io/xnhec/

ความคิดเห็น • 27

  • @shaarg
    @shaarg 5 ปีที่แล้ว +25

    Literally the best videos. Way too underrated channel.

  • @archstampton5910
    @archstampton5910 5 ปีที่แล้ว +9

    This channel is a hidden gem

  • @TheBjjninja
    @TheBjjninja 5 ปีที่แล้ว +5

    Thank you. Cooler with the sunglasses though, damn that asynch video was so cool...

    •  5 ปีที่แล้ว +1

      Haha, well maybe I should reintroduce the glasses then.

    • @TheBjjninja
      @TheBjjninja 5 ปีที่แล้ว

      Sebastiaan Mathôt with the sunglasses, I am not certain if you are getting ready to teach Python, or how to invest in Bitcoin LOL

  • @Septix
    @Septix 4 ปีที่แล้ว +1

    Jesus H. Christ... a fter so many forums read and videos watched ,easily the best and most clear multi processing video thank you sir.

  • @NetDevAutomate
    @NetDevAutomate 5 ปีที่แล้ว +4

    Another fantastic tutorial! Your explanations and presentation style always make the subject matter easier to understand and enjoyable to watch. A huge thanks for the ongoing videos.

  • @karthikt5033
    @karthikt5033 5 ปีที่แล้ว +1

    Awesome... succinct and precise... there are only a few other channels that make learning python enjoyable and easy-breezy

  • @seeramtrinath5315
    @seeramtrinath5315 4 ปีที่แล้ว +1

    Fantastic...nice intro; and cool please continue making the videos like this request not to give up due to fewer views.

  • @benyaminyakobi3652
    @benyaminyakobi3652 2 ปีที่แล้ว +1

    Great content! Thank you.

  • @jadia
    @jadia 3 ปีที่แล้ว

    I'm glad that I found your channel. Thanks man! Very informative and useful video.

  • @thebuggser2752
    @thebuggser2752 2 ปีที่แล้ว

    An excellent presentation of a useful topic.
    You have an outstanding ability to explain concepts.
    Thanks!

  • @ShanilPanara
    @ShanilPanara 3 ปีที่แล้ว +1

    Another great video! Thank you :)

  • @andriysvitelskyi5821
    @andriysvitelskyi5821 ปีที่แล้ว

    good , appreciate your work

  • @onlymusic2005
    @onlymusic2005 4 ปีที่แล้ว

    Great 👍... looking forward to more python videos

  • @murugesanv3558
    @murugesanv3558 5 ปีที่แล้ว

    Great work dude .... Keep the contents flowing every week if possible .....

  • @mrj1997
    @mrj1997 5 ปีที่แล้ว

    Thank You Sebastiaan.

  • @sergeyv1534
    @sergeyv1534 5 ปีที่แล้ว +1

    Hello,
    good explanation! Go ahead.
    could you pls. explain in future movies - multi-inheritance, composition and aggregation / OOP?

    •  5 ปีที่แล้ว +2

      Thanks for your interest. I've been considering doing exactly that for a while. Object-oriented programming is a very big topic that would require a series of video lectures, and thus a lot of time. So for now it's a maybe!

    • @sergeyv1534
      @sergeyv1534 5 ปีที่แล้ว

      @ yes, absolutely agree. These might be just a few ideas for future videos. There are a lot of channels with beginner- and middle level. But like this One - it’s just a few.

  • @vanlichtinstein
    @vanlichtinstein 3 ปีที่แล้ว

    So in the instance with smaller numbers, the multiprocessing is taking longer because of the lag of sending the functions to other processors and returning the values is slower than just computing on the same processor?

  • @mohammadanbar8509
    @mohammadanbar8509 4 ปีที่แล้ว

    very well explained, thx Sebastiaan, but when I execute the exact same code on my jupyter notebook it keeps running and it doesn't stop neither results come up , any suggestions?

  • @elachichai
    @elachichai 2 ปีที่แล้ว

    mp.Pool() hangs the program ... I see multiple times start fact(50000)

  • @GMC997
    @GMC997 4 ปีที่แล้ว

    Well, I tried your example in the Anaconda distribution of Jupyter, but when I execute the cell it doesn't output anything and it doesn't stop as well.
    Here is my code for reference:
    import multiprocessing as mp
    t0 = time.time()
    with mp.Pool() as pool:
    result = pool.map(factorial, NUMBERS)
    t1 = time.time()
    print(f"Excecution took {t1-t0:.4f}")
    PS: I have 16 Cores, but I've tried to limit the processes to 2.

    • @mohammadanbar8509
      @mohammadanbar8509 4 ปีที่แล้ว

      I have the exact same issue except that the process I have set is 4

  • @irays3r
    @irays3r 5 ปีที่แล้ว

    Hello,
    at the moment I have the following code (I use the _thread module):
    for thread_num, (continent, name, trade) in enumerate( zip(needed_continent_info, con.sheet_name_list, trade_val)):
    start_new_thread(gapi.api, (continent, date, trade, name, client[thread_num], thread_num))
    How I can do the same thing with the "mp" module?

    •  5 ปีที่แล้ว

      Thanks for your comment. This seems like the type of question that is too complicated for a TH-cam comment section! I would post this on a site like StackOverflow, with a clear description of what exactly you're trying to do!