PLAY PODCASTS
Comparing Real-World Python Performance Against Big O
Episode 257

Comparing Real-World Python Performance Against Big O

The Real Python Podcast · Real Python

July 11, 202545m 1s

Audio is streamed directly from the publisher (dts.podtrac.com) as published in their RSS feed. Play Podcasts does not host this file. Rights-holders can request removal through the copyright & takedown page.

Show Notes

<p>How does the performance of an algorithm hold up when you put it into a realistic context? Where might Python code defy Big O notation expectations when using a profiler? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&rsquo;s Weekly articles and projects.</p> <p>Christopher shares an article about why real-world performance often defies Big O expectations. The piece starts with a task coded in Go and then optimized from <code>O(n²)</code> to <code>O(n)</code>. Can an interpreted language like Python compete with a compiled language? Profiling the performance of both versions provides some interesting results. </p> <p>We also share several other articles and projects from the Python community, including a news roundup, the fastest way to detect a vowel in a string, whether Python dictionaries are ordered data structures, an overview of Python&rsquo;s <code>enum</code> module, a Python client library for Google Data Commons, and a project to convert plain ASCII to &ldquo;smart&rdquo; punctuation.</p> <div class="alert alert-primary" role="alert"> <p><strong>Course Spotlight:</strong> <a href="https://realpython.com/courses/python-enum/">Building Enumerations With Python&rsquo;s enum</a></p> <p>In this video course, you&rsquo;ll discover the art of creating and using enumerations of logically connected constants in Python. To accomplish this, you&rsquo;ll explore the <code>Enum</code> class and other associated tools and types from the <code>enum</code> module in the Python standard library.</p> </div> <p>Topics:</p> <ul> <li>00:00:00 &ndash; Introduction</li> <li>00:02:12 &ndash; ruff Release 0.12.0</li> <li>00:02:38 &ndash; streamlit Release 1.46.0</li> <li>00:02:48 &ndash; lxml 6.0.0 Released</li> <li>00:03:00 &ndash; PSF Board Election Schedule</li> <li>00:03:26 &ndash; Are Python Dictionaries Ordered Data Structures?</li> <li>00:08:59 &ndash; The Fastest Way to Detect a Vowel in a String</li> <li>00:16:37 &ndash; Module enum Overview</li> <li>00:24:46 &ndash; Video Course Spotlight</li> <li>00:26:24 &ndash; O(no) You Didn&rsquo;t</li> <li>00:38:34 &ndash; New Python Client Library for Google Data Commons</li> <li>00:41:55 &ndash; smartypants.py: Plain ASCII to &ldquo;Smart&rdquo; Punctuation</li> <li>00:44:07 &ndash; Thanks and goodbye</li> </ul> <p>News:</p> <ul> <li><a href="https://github.com/astral-sh/ruff/releases/tag/0.12.0"><code>ruff</code> Release 0.12.0</a></li> <li><a href="https://github.com/streamlit/streamlit/releases/tag/1.46.0"><code>streamlit</code> Release 1.46.0</a></li> <li><a href="https://github.com/lxml/lxml/releases/tag/lxml-6.0.0"><code>lxml</code> 6.0.0 Released</a></li> <li><a href="https://pyfound.blogspot.com/2025/06/2025-psf-board-election-schedule.html">PSF Board Election Schedule</a> &ndash; It is time for the Python Software Foundation Board elections. Nominations are due by July 29th. See the article for the full election schedule and deadlines.</li> </ul> <p>Show Links:</p> <ul> <li><a href="https://www.thepythoncodingstack.com/p/are-python-dictionaries-ordered-data">Are Python Dictionaries Ordered Data Structures?</a> &ndash; Although dictionaries have maintained insertion order since Python 3.6, they aren&rsquo;t strictly speaking ordered data structures. Read on to find out why and how the edge cases can be important depending on your use case.</li> <li><a href="https://austinhenley.com/blog/vowels.html">The Fastest Way to Detect a Vowel in a String</a> &ndash; If you need to find the vowels in a string there are several different approaches you could take. This article covers 11 different ways and how each performs.</li> <li><a href="https://mathspp.com/blog/module-enum-overview">Module <code>enum</code> Overview</a> &ndash; This article gives an overview of the tools available in the module enum and how to use them, including Enum, auto, StrEnum, Flag, and more.</li> <li><a href="https://mrshiny608.github.io/MrShiny608/optimisation/2025/04/22/OhNoYouDidnt.html">O(no) You Didn&rsquo;t</a> &ndash; A deep dive into why real-world performance often defies Big-O expectations, and why context and profiling matter more than theoretical complexity.</li> </ul> <p>Projects:</p> <ul> <li><a href="https://developers.googleblog.com/en/pythondatacommons/">New Python Client Library for Google Data Commons</a> &ndash; Google Data Commons announced the general availability of its new Python client library for the Data Commons. The goal of the library is to enhance how students, researchers, analysts, and data scientists access and leverage Data Commons.</li> <li><a href="https://github.com/justinmayer/smartypants.py">smartypants.py: Plain ASCII to &ldquo;Smart&rdquo; Punctuation</a></li> </ul> <p>Additional Links:</p> <ul> <li><a href="http://betteridgeslaw.com/">Betteridge&rsquo;s Law</a></li> <li><a href="https://docs.python.org/3/library/collections.html#ordereddict-objects">collections — Container datatypes — Python 3.13.5 documentation</a></li> <li><a href="https://realpython.com/python-ordereddict/">OrderedDict vs dict in Python: The Right Tool for the Job – Real Python</a></li> <li><a href="https://realpython.com/python-enum/">Build Enumerations of Constants With Python&rsquo;s Enum – Tutorial</a></li> <li><a href="https://realpython.com/courses/python-enum/">Building Enumerations With Python&rsquo;s enum - Video Course</a></li> <li><a href="https://github.com/datacommonsorg/api-python/tree/master/datacommons_client">Python client library for the Data Commons</a> </li> <li><a href="https://pycoders.com/submissions">PyCoder&rsquo;s Weekly - Submit a Link</a></li> </ul> <p>Level up your Python skills with our expert-led courses:</p> <ul> <li><a href="https://realpython.com/courses/looping-with-python-enumerate/">Looping With Python enumerate()</a></li> <li><a href="https://realpython.com/courses/sorting-dictionaries-keys-values-more/">Sorting Dictionaries in Python: Keys, Values, and More</a></li> <li><a href="https://realpython.com/courses/python-enum/">Building Enumerations With Python&#x27;s enum</a></li> </ul> <p><a rel="payment" href="https://realpython.com/join">Support the podcast &amp; join our community of Pythonistas</a></p>