I'm here today to talk about why your Python script runs slow.
Let's get into the top 2 reasons!
Number one: Poor Data Structures. If your data is stored inefficiently, it can take a lot of time for the script to process. So make sure you're using the right data structure for the job.
For example, if you often check the presence of an item in a list, you might use a set that can do it in constant time (instead of linear time for a list).
Checkout the TimeComplexity page on the Python wiki for details about all the data structures : https://wiki.python.org/moin/TimeComp...
Number two: Unnecessary Computations. If your script is doing too much work, it will take longer. Try to optimize your code to reduce the number of computations.
For example, use caching if you do over and over the same computations. It's easy and will save you lots of time.
So there you have it! Those are my top 2 reasons why your Python script is slow.
Hopefully you liked this video 💚
🔥 Subscribe to Bitswired
👍🏽 Leave us a like/comment to support us
💬HASHTAGS:
#python #pythonprogramming #codingtips #coding #programming #learnprogramming #learnpython #learncoding #interview #cofinginterview #optimization #slow #fast #peoplewhocode #codinglife #shorts #short
Auf dieser Seite können Sie das Online-Video 2 Reasons Why Your Python Script Runs Slow mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Bitswired 09 Dezember 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 553 Mal angesehen und es wurde von 9 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!