Zip Vs Range - Which is Faster? Benchmarking YOUR code suggestions too!

Опубликовано: 10 Октябрь 2024
на канале: Python Simplified
13,634
459

In my recent Dictionary Comprehension tutorial, I've asked you which of the two approaches you think is faster - zip or range? today we will empirically measure the speed of both algorithms within for loops and within comprehensions.
In addition, I've collected a few of YOUR code examples from the comment section (which is even more exciting to benchmark 😉)
Checkout my recent tutorial here for more information:
⭐ Dictionary Comprehension:
   • Dictionary Comprehension - Create Com...  

For this stream, I'm borrowing Badger's benchmarking code. You can find it on Github and use it on your own functions 😀:
https://gist.github.com/JBraunsmaJr/c...

Originally Badger's code was meant to check whether LIST comprehensions are faster than for loops and under which condition. It came up in the viewer comments of another recent tutorial:
⭐ List Comprehension:
   • List Comprehension - BEST Python feat...  

In other words - this stream will introduce us to advanced concepts of analyzing algorithms and their running time. So it's not about just making things work, but making them work efficiently! 💪💪💪

Also, I figured out what to do with shorts! Will tell you all about it in this stream! See you soon! 😍

🤝 Connect with me 🤝
--------------------------------------
🔗 Github:
https://github.com/mariyasha
🔗 Discord:
  / discord  
🔗 LinkedIn:
  / mariyasha888  
🔗 Twitter:
  / mariyasha888  
🔗 Blog:
https://www.pythonsimplified.org