2 Reasons Why Your Python Script Runs Slow

Pubblicato il: 09 dicembre 2022
sul canale di: Bitswired
553
9

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


In questa pagina del sito puoi guardare il video online 2 Reasons Why Your Python Script Runs Slow della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Bitswired 09 dicembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 553 volte e gli è piaciuto 9 spettatori. Buona visione!