Garbage Collection in Python: Speed Up Your Code

Поделиться
HTML-код
  • Опубликовано: 10 фев 2025

Комментарии • 26

  • @lowkeygaming4716
    @lowkeygaming4716 Год назад +3

    Great video. You always give me new knowledge to improve my Python code and don't just settle in the "if it works, don't touch it" mindset.

  • @ventsiR
    @ventsiR Год назад +1

    Please keep doing these, you explain things really well and thoroughly!

  • @albertwayadav
    @albertwayadav Год назад +1

    Thank you for the video man. Cleared a lot of my querries in just 15 minutes.

  • @dangalimov7435
    @dangalimov7435 Год назад +11

    Really interesting topic. Do you have a video about how memory in python implemented? (about heaps, stacks, references to objects etc.)

  • @terrygmx84
    @terrygmx84 3 месяца назад

    Thank you very much! A great short video really helped me understand GC in python.

  • @PhoebusG
    @PhoebusG Год назад

    great topic and review, as always, keep it up pybro :)

  • @pietraderdetective8953
    @pietraderdetective8953 Год назад

    great topic to touch on!
    other than the speedup benefits, there are consequences as well if we disable garbage collection: memory leaks, manual management is hard.
    I also agree with some comments pointing out using gc.collect() manually in a running function makes it slower.

  • @MichielJ71
    @MichielJ71 Год назад +2

    Thanks for the interesting video's. Have a nice 2024!

  • @FOXFHEX1
    @FOXFHEX1 Год назад +1

    Best py developer in the world ❤

  • @piotrmazgaj
    @piotrmazgaj 4 месяца назад

    Nice video!

  • @skf957
    @skf957 Год назад +1

    Great video, thank you for making it. Probably not a use-case for me but nonetheless I found the whole topic fascinating, and really well explained. Please consider covering more of these "under the hood" topics.
    For about a year I struggled to learn C++ (I'm only a hobbyist) thinking all the while that Python was a bit "mickey mouse". Then I came back to it when I realised that pretty much everything I would want to do was more than catered for in Python. OK, so the trade-off is speed - but that's fine for me, and easily outweighs the fairly complex tool chains that are required for C++.

    • @zenova9926
      @zenova9926 Год назад

      Don't worry bro, Mojo (a superset of python, like typescript to javascript) is becoming mainstream soon and it's as fast as rust.

    • @legion_prex3650
      @legion_prex3650 6 месяцев назад

      @@zenova9926 Mojo still has garbage collection, which makes it irrelevant for system programming. Mojo is for number crunching but not at all for time critical operations (like what you need in schedulers, databases, operating systems). Thats where C is still standard and Rust now entering the scene on the linux kernel. Despite the speed, Mojo solves a lot of problems with different types of GPUs, which are needed for AI. So, depends on what you wanna do. @skf957 was talking about C++, sounds like system or game programming. neither of them will ever be written with Mojo.

  • @wannahidemyname
    @wannahidemyname Год назад +1

    Awesome explanation. I've a question. When do you suggest to manually turn off GC and what will be the benefits? Say I'm processing a huge set of data and creating a new structure. The size of set is 80K. Now turning of GC will speed up the process but will increase the memory usage. So when should we consider the manual approach?

    • @wannahidemyname
      @wannahidemyname Год назад

      @@AvacadoJuice-q9b Thanks for the explanation. I would experiment with these.

  • @anton-r
    @anton-r Год назад

    very interesting thanks a lot. Now I am curious how it's gonna file in a real system with `celery workers` etc.

  • @lizandro_mendoza
    @lizandro_mendoza Год назад +1

    Thanks

  • @malakarakesh3139
    @malakarakesh3139 Год назад

    at 3:53 a reference to L1 from L3 doesn't seem to matter right?

  • @gsm7490
    @gsm7490 9 месяцев назад

    Do context managers help to avoid unnecessary garbage in memory?

  • @cyborgcodes
    @cyborgcodes Год назад

    Interesting video

  • @voiderashish272
    @voiderashish272 Год назад +1

    which video editor you use in pop os, i am getting problem in installing Davinci resolve. Can you help?

    • @rahul38474
      @rahul38474 Год назад

      Shotcut is also a FOSS alternative

  • @oliverli9630
    @oliverli9630 Год назад

    wow!! wtf! awesome

  • @TomKnudsen
    @TomKnudsen Год назад

    Who’s code did you rip of this time? Who’s comment did you delete?