TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The High Price of Abstraction in Python

3 pointsby nickdrozdabout 2 years ago

1 comment

xcombelleabout 2 years ago
1- try to run the last version of python, there is speed improvement in 3.10 and 3.11<p><pre><code> &gt;&gt;&gt; import sys; sys.version &#x27;3.10.4 (main, Dec 2 2022, 17:52:13) [Clang 14.0.0 (clang-1400.0.29.202)]&#x27; 51.94417405128479 37.79175686836243 100.8145821094513 </code></pre> 2- global variable lookup is costly in python, putting the whole thing in a main() function halves the running time<p><pre><code> 22.97948908805847 22.47922682762146 59.1025867462158 </code></pre> link to my code:<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;xcombelle&#x2F;8ac84ccb276f8996ed1a458ee2b3efa7" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;xcombelle&#x2F;8ac84ccb276f8996ed1a458ee2...</a>