48 comments

  • thundergolfer8 hours ago
    A lot of people here are commenting that if you have to care about specific latency numbers in Python you should just use another language.<p>I disagree. A lot of important and large codebases were grown and maintained in Python (Instagram, Dropbox, OpenAI) and it&#x27;s damn useful to know how to reason your way out of a Python performance problem when you inevitably hit one <i>without</i> dropping out into another language, which is going to be far more complex.<p>Python is a very useful tool, and knowing these numbers just makes you better at using the tool. The author is a <i>Python Software Foundation Fellow</i>. They&#x27;re great at using the tool.<p>In the common case, a performance problem in Python is not the result of hitting the limit of the language but the result of sloppy un-performant code, for example unnecessarily calling a function O(10_000) times in a hot loop.<p>I wrote up a more focused &quot;Python latency numbers you should know&quot; as a quiz here <a href="https:&#x2F;&#x2F;thundergolfer.com&#x2F;computers-are-fast" rel="nofollow">https:&#x2F;&#x2F;thundergolfer.com&#x2F;computers-are-fast</a>
    • NoteyComplexity2 hours ago
      Agreed, and on top of that:<p>I think these kind of numbers are everywhere and not just specific to Python.<p>In zig, I sometimes take a brief look to the amount of cpu cycles of various operations to avoid the amount of cache misses. While I need to aware of the alignment and the size of the data type to debloat a data structure. If their logic applies, too bad, I should quit programming since all languages have their own latency on certain operations we should aware of.<p>There are reasons to not use Python, but that particular reason is not the one.
    • i_am_a_peasant6 hours ago
      our build system is written in python, and i’d like it not to suck but still stay in python, so these numbers very much matter.
    • Scubabear683 hours ago
      No.<p>Python’s issue is that it is incredibly slow in use cases that surprise average developers. It is incredibly slow at very basic stuff, like calling a function or accessing a dictionary.<p>If Python didn’t have such an enormous number of popular C and C++ based libraries it would not be here. It was saved by Numpy etc etc.
    • oofbey7 hours ago
      I think both points are fair. Python is slow - you should avoid it if speed is critical, but sometimes you can’t easily avoid it.<p>I think the list itself is super long winded and not very informative. A lot of operations take about the same amount of time. Does it matter that adding two ints is very slightly slower than adding two floats? (If you even believe this is true, which I don’t.) No. A better summary would say “all of these things take about the same amount of time: simple math, function calls, etc. these things are much slower: IO.” And in that form the summary is pretty obvious.
      • microtonal7 hours ago
        <i>I think the list itself is super long winded and not very informative.</i><p>I agree. I have to complement the author for the effort put in. However it misses the point of the original <i>Latency numbers every programmer should know</i>, which is to build an intuition for making good ballpark estimations of the latency of operations and that e.g. A is two orders of magnitude more expensive than B.
    • nutjob27 hours ago
      &gt; A lot of important and large codebases were grown and maintained in Python<p>How does this happen? Is it just inertia that cause people to write large systems in a essentially type free, interpreted scripting language?
      • hibikir7 hours ago
        Small startups end up writing code in whatever gets things working faster, because having too large a codebase with too much load is a champagne problem.<p>If I told you that we were going to be running a very large payments system, with customers from startups to Amazon, you&#x27;d not write it in ruby and put the data in MongoDB, and then using its oplog as a queue... but that&#x27;s what Stripe looked like. They even hired a compiler team to add type checking to the language, as that made far more sense than porting a giant monorepo to something else.
      • xboxnolifes7 hours ago
        It&#x27;s very simple. Large systems start as small systems.
        • dragonwriter5 hours ago
          Large systems are often aggregates of small systems, too.
      • oivey7 hours ago
        It’s a nice and productive language. Why is that incomprehensible?
      • wiseowise4 hours ago
        Python has types, now even gradual static typing if you want to go further. It&#x27;s irrelevant whether language is interpreted scripting if it solves your problem.
      • tjwebbnorfolk4 hours ago
        Most large things begin life as small things.
      • oofbey7 hours ago
        It’s very natural. Python is fantastic for going from 0 to 1 because it’s easy and forgiving. So lots of projects start with it. Especially anything ML focused. And it’s much harder to change tools once a project is underway.
        • passivegains7 hours ago
          this is absolutely true, but there&#x27;s an additional nuance: yes, python is fantastic, yes, it&#x27;s easy and forgiving, but there are other languages like that too. ...except there really aren&#x27;t. other than ruby and maybe go, every other popular language sacrifices ease of use for things that simply do not matter for the overwhelming majority of programs. much of python&#x27;s popularity doesn&#x27;t come from being easy and forgiving, it&#x27;s that everything else isn&#x27;t. for normal programming why would we subject ourselves to anything <i>but</i> python unless we had no choice?<p>while I&#x27;m on the soapbox I&#x27;ll give java a special mention: a couple years ago I&#x27;d have said java was easy even though it&#x27;s tedious and annoying, but I&#x27;ve become reacquainted with it for a high school program (python wouldn&#x27;t work for what they&#x27;re doing and the school&#x27;s comp sci class already uses java.)<p>this year we&#x27;re switching to c++.
          • zelphirkalt4 hours ago
            Omg, switching to C++ for pupils programming beginners ... &quot;How to turn off the most students from computer programming?&quot; 101. Really can&#x27;t get much worse than C++ for beginners.
            • nightfly45 minutes ago
              PSU (Oregon) uses C++ as just &quot;c with classes&quot; and ignores the rest of C++ for intro to programming courses. It frustrates people who already use C++ but otherwise works pretty well.
      • IshKebab3 hours ago
        Someone says &quot;let&#x27;s write a prototype in Python&quot; and someone else says &quot;are you sure we shouldn&#x27;t use a a better language that is just as productive but isn&#x27;t going to lock us into abysmal performance down the line?&quot; but everyone else says &quot;nah we don&#x27;t need to worry about performance yet, and anyway it&#x27;s just a prototype - we&#x27;ll write a proper version when we need to&quot;...<p>10 years later &quot;ok it&#x27;s too slow; our options are a) spend $10m more on servers, b) spend $5m writing a faster Python runtime before giving up later because nobody uses it, c) spend 2 years rewriting it and probably failing, during which time we can make no new features. a) it is then.&quot;
        • rented_mule5 minutes ago
          What many startups need to succeed is to be able to pivot&#x2F;develop&#x2F;repeat very quickly to find a product+market that makes money. If they don&#x27;t find that, and most don&#x27;t, the millions you talk about never come due. They also rarely have enough developers, so developer productivity in the short term is vital to that iteration speed. If that startup turns into Dropbox or Instagram, the millions you mention are round-off error on many billions. Easy business decision, and startups are first and foremost businesses.<p>Some startups end up in between the two extremes above. I was at one of the Python-based ones that ended up in the middle. At $30M in annual revenue, Python was handling 100M unique monthly visitors on 15 cheap, circa-2010 servers. By the time we hit $1B in annual revenue, we had Spark for both heavy batch computation and streaming computation tasks, and Java for heavy online computational workloads (e.g., online ML inference). There were little bits of Scala, Clojure, Haskell, C++, and Rust here and there (with well over 1K developers, things creep in over the years). 90% of the company&#x27;s code was still in Python and it worked well. Of course there were pain points, but there always are. At $1B in annual revenue, there was budget for investments to make things better (cleaning up architectural choices that hadn&#x27;t kept up, adding static types to core things, scaling up tooling around package management and CI, etc.).<p>But a key to all this... the product that got to $30M (and eventually $1B+) looked nothing like what was pitched to initial investors. It was unlikely that enough things could have been tried to land on the thing that worked without excellent developer productivity early on. Engineering decisions are not only about technical concerns, they are also about the business itself.
        • fud10124 minutes ago
          I don&#x27;t know a better open source language than Python. Java and C# are both better (platforms) but they come with that obvious corporate catch.
        • gcanyon3 hours ago
          What language is “just as productive but isn&#x27;t going to lock us into abysmal performance down the line”?<p>What makes that language not strictly superior to Python?
          • nazgul171 hour ago
            Loose typing makes you really fast at writing code, as long as you can keep all the details in your head. Python is great for smaller stuff. But crossed some threshold, the lack of a mechanism that has your back starts slowing you down.
  • fooker10 hours ago
    Counterintuitively: program in python only if you can get away without knowing these numbers.<p>When this starts to matter, python stops being the right tool for the job.
    • libraryofbabel10 hours ago
      Or keep your Python scaffolding, but push the performance-critical bits down into a C or Rust extension, like numpy, pandas, PyTorch and the rest all do.<p>But I agree with the spirit of what you wrote - these numbers are interesting but aren’t worth memorizing. Instead, instrument your code in production to see where it’s slow in the real world with real user data (premature optimization is the root of all evil etc), profile your code (with pyspy, it’s the best tool for this if you’re looking for cpu-hogging code), and if you find yourself worrying about how long it takes to add something to a list in Python you really shouldn’t be doing that operation in Python at all.
      • eichin9 hours ago
        &quot;if you&#x27;re not measuring, you&#x27;re not optimizing&quot;
    • Demiurge8 hours ago
      I agree. I&#x27;ve been living off Python for 20 years and have never needed to know any of these numbers, nor do I need them now, for my work, contrary to the title. I also regularly use profiling for performance optimization and opt for Cython, SWIG, JIT libraries, or other tools as needed. None of these numbers would ever factor into my decision-making.
      • AtlasBarfed7 hours ago
        .....<p>You don&#x27;t see any value in knowing that numbers?
        • Demiurge1 hour ago
          That&#x27;s what I just said. There is zero value to me knowing these numbers. I assume that all python built in methods are pretty much the same speed. I concentrate on IO being slow, minimizing these operations. I think about CPU intensive loops that process large data, and I try to use libraries like numpy, DuckDB, or other tools to do the processing. If I have a more complicated system, I profile its methods, and optimize tight loops based on PROFILING. I don&#x27;t care what the numbers in the article are, because I PROFILE, and I optimize the procedures that are the slowest, for example, using cython. Which part of what I am saying does not make sense?
        • TuringTest6 hours ago
          As others have pointed out, Python is better used in places where those numbers aren&#x27;t relevant.<p>If they start becoming relevant, it&#x27;s usually a sign that you&#x27;re using the language in a domain where a duck-typed bytecode scripting-glue language is not well-suited.
    • MontyCarloHall10 hours ago
      Exactly. If you&#x27;re working on an application where these numbers matter, Python is far too high-level a language to actually be able to optimize them.
    • bathtub3657 hours ago
      These basically seem like numbers of last resort. After you’ve profiled and ruled out all of the usual culprits (big disk reads, network latency, polynomial or exponential time algorithms, wasteful overbuilt data structures, etc) and need to optimize at the level of individual operations.
    • Quothling8 hours ago
      Why? I&#x27;ve build some massive analytic data flows in Python with turbodbc + pandas which are basically C++ fast. It uses more memory which supports your point, but on the flip-side we&#x27;re talking $5-10 extra cost a year. It could frankly be $20k a year and still be cheaper than staffing more people like me to maintain these things, rather than having a couple of us and then letting the BI people use the tools we provide for them. Similarily when we do embeded work, micro-python is just so much easier to deal with for our engineering staff.<p>The interoperability between C and Python makes it great, and you need to know these numbers on Python to know when to actually build something in C. With Zig getting really great interoperability, things are looking better than ever.<p>Not that you&#x27;re wrong as such. I wouldn&#x27;t use Python to run an airplane, but I really don&#x27;t see why you wouldn&#x27;t care about the resources just because you&#x27;re working with an interpreted or GC language.
      • fooker8 hours ago
        &gt; you need to know these numbers on Python to know when to actually build something in C<p>People usually approach this the other way, use something like pandas or numpy from the beginning if it solves your problem. Do not write matrix multiplications or joins in python at all.<p>If there is no library that solves your problem, it&#x27;s a great indication that you should avoid python. Unless you are willing to spend 5 man-years writing a C or C++ library with good python interop.
        • oivey7 hours ago
          People generally aren’t rolling their own matmuls or joins or whatever in production code. There are tons of tools like Numba, Jax, Triton, etc that you can use to write very fast code for new, novel, and unsolved problems. The idea that “if you need fast code, don’t write Python” has been totally obsolete for over a decade.
          • fooker7 hours ago
            Yes, that&#x27;s what I said.<p>If you are writing performance sensitive code that is not covered by a popular Python library, don&#x27;t do it unless you are a megacorp that can put a team to write and maintain a library.
            • oivey7 hours ago
              It isn’t what you said. If you want, you can write your own matmul in Numba and it will be roughly as fast as similar C code. You shouldn’t, of course, for the same reason handrolling your own matmuls in C is stupid.<p>Many problems can performantly solved in pure Python, especially via the growing set of tools like the JIT libraries I cited. Even more will be solvable when things like free threaded Python land. It will be a minority of problems that can’t be, if it isn’t already.
      • its-summertime7 hours ago
        From the complete opposite side, I&#x27;ve built some tiny bits of near irrelevant code where python has been unacceptable, e.g. in shell startup &#x2F; in bash&#x27;s PROMPT_COMMAND, etc. It ends up having a very painfully obvious startup time, even if the code is nearing the equivalent of Hello World<p><pre><code> time python -I -c &#x27;print(&quot;Hello World&quot;)&#x27; real 0m0.014s time bash --noprofile -c &#x27;echo &quot;Hello World&quot;&#x27; real 0m0.001s</code></pre>
        • dekhn6 hours ago
          What exactly do you need 1ms instead of 14ms startup time in a shell startup? The difference is barely perceptible.<p>Most of the time starting up is time spent seartching the filesystem for thousands of packages.
          • NekkoDroid6 hours ago
            &gt; What exactly do you need 1ms instead of 14ms startup time in a shell startup?<p>I think as they said: when dynamically building a shell input prompt it starts to become very noticable if you have like 3 or more of these and you use the terminal a lot.
            • dekhn3 hours ago
              Ah, I only noticed the &quot;shell startup&quot; bit.<p>Yes, after 2-3 I agree you&#x27;d start to notice if you were really fast. I suppose at that point I&#x27;d just have Gemini rewrite the prompt-building commands in Rust (it&#x27;s quite good at that) or merge all the prompt-building commands into a single one (to amortize the startup cost).
  • zelphirkalt10 hours ago
    I doubt there is much to gain from knowing how much memory an empty string takes. The article or the listed numbers have a weird fixation on memory usage numbers and concrete time measurements. What is way more important to &quot;every programmer&quot; is time and space complexity, in order to avoid designing unnecessarily slow or memory hungry programs. Under the assumption of using Python, what is the use of knowing that your int takes 28 bytes? In the end you will have to determine, whether the program you wrote meats the performance criteria you have and if it does not, then you need a smarter algorithm or way of dealing with data. It helps very little to know that your 2d-array of 1000x1000 bools is so and so big. What helps is knowing, whether it is too much and maybe you should switch to using a large integer and a bitboard approach. Or switch language.
    • kingstnap7 hours ago
      I disagree. Performance is a leaky abstraction that *ALWAYS* matters.<p>Your cognition of it is either implicit or explicit.<p>Even if you didn&#x27;t know for example that list appends was linear and not quadratic and fairly fast.<p>Even if you didn&#x27;t give a shit if simple programs were for some reason 10000x slower than they needed to be because it meets some baseline level of good enough &#x2F; and or you aren&#x27;t the one impacted by the problems inefficacy creates.<p>Library authors beneath you would still know and the APIs you interact with and the pythonic code you see and the code LLMS generate will be affected by that leaky abstraction.<p>If you think that n^2 naive list appends is a bad example its not btw, python string appends are n^2 and that has and does affect how people do things, f strings for example are lazy.<p>Similarly a direct consequence of dictionaries being fast in Python is that they are used literally everywhere. The old Pycon 2017 talks from Raymond talk about this.<p>Ultimately what the author of the blog has provided is this sort of numerical justification for the implicit tacit sort of knowledge performance understanding gives.
    • Qem10 hours ago
      &gt; Under the assumption of using Python, what is the use of knowing that your int takes 28 bytes?<p>Relevant if your problem demands instatiation of a large number of objects. This reminds me of a post where Eric Raymond discusses the problems he faced while trying to use Reposurgeon to migrate GCC. See <a href="http:&#x2F;&#x2F;esr.ibiblio.org&#x2F;?p=8161" rel="nofollow">http:&#x2F;&#x2F;esr.ibiblio.org&#x2F;?p=8161</a>
  • cma2568 minutes ago
    Great catalogue. On the topic of msgspec, since pydantic is included it may be worth including a bench for de-serializing and serializing from a msgspec struct.
  • Aurornis9 hours ago
    A meta-note on the title since it looks like it’s confusing a lot of commenters: The title is a play on Jeff Dean’s famous “Latency Numbers Every Programmer Should Know” from 2012. It isn’t meant to be interpreted literally. There’s a common theme in CS papers and writing to write titles that play upon themes from past papers. Another common example is the “_____ considered harmful” titles.
    • shanemhansen8 hours ago
      Going to write a real banger of a paper called &quot;latency numbers considered harmful is all you need&quot; and watch my academic cred go through the roof.
      • AnonymousPlanet5 hours ago
        &quot; ... with an Application to the Entscheidungsproblem&quot;
    • Kwpolska9 hours ago
      This title only works if the numbers are actually useful. Those are not, and there are far too many numbers for this to make sense.
      • Aurornis8 hours ago
        The title was meant to be taken literally, as in you&#x27;re supposed to memorize all of these numbers. It was meant as an in-joke reference to the original writing to signal that this document was going to contain timing values for different operations.<p>I completely understand why it&#x27;s frustrating or confusing by itself, though.
    • willseth8 hours ago
      Good callout on the paper reference, but this author gives gives every indication that he’s dead serious in the first paragraph. I don’t think commenters are confused.
    • dekhn6 hours ago
      That doc predates 2012 significantly.<p>From what I&#x27;ve been able to glean, it was basically created in the first few years Jeff worked at Google, on indexing and serving for the original search engine. For example, the comparison of cache, RAM, and disk: determined whether data was stored in RAM (the index, used for retrieval) or disk (the documents, typically not used in retrieval, but used in scoring). Similarly, the comparison of California-Netherlands time- I believe Google&#x27;s first international data cetner was in NL and they needed to make decisions about copying over the entire index in bulk versus serving backend queries in the US with frontends in the NL.<p>The numbers were always going out of date; for example, the arrival of flash drives changed disk latency significantly. I remember Jeff came to me one day and said he&#x27;d invented a compression algorithm for genomic data &quot;so it can be served from flash&quot; (he thought it would be wasteful to use precious flash space on uncompressed genomic data).
  • willseth10 hours ago
    Every Python programmer should be thinking about far more important things than low level performance minutiae. Great reference but practically irrelevant except in rare cases where optimization is warranted. If your workload grows to the point where this stuff actually matters, great! Until then it’s a distraction.
    • HendrikHensen8 hours ago
      Having general knowledge about the tools you&#x27;re working with is not a distraction, it&#x27;s an intellectual enrichment in any case, and can be a valuable asset in specific cases.
      • willseth8 hours ago
        Knowing that an empty string is 41 bytes or how many ns it takes to do arithmetic operations is not general knowledge.
        • oivey7 hours ago
          How is it not general knowledge? How do you otherwise gauge if your program is taking a reasonable amount of time, and, if not, how do you figure out how to fix it?
          • dirtbag__dad1 hour ago
            In my experience, which is series A or earlier data intensive SaaS, you can gauge whether a program is taking a reasonable amount of time just by running it and using your common sense.<p>P50 latency for a fastapi service’s endpoint is 30+ seconds. Your ingestion pipeline, which has a data ops person on your team waiting for it to complete, takes more than one business day to run.<p>Your program is obviously unacceptable. And, your problems are most likely completely unrelated to these heuristics. You either have an inefficient algorithm or more likely you are using the wrong tool (ex OLTP for OLAP) or the right tool the wrong way (bad relational modeling or an outdated LLM model).<p>If you are interested in shaving off milliseconds in this context then you are wasting your time on the wrong thing.<p>All that being said, I’m sure that there’s a very good reason to know this stuff in the context of some other domains, organizations, company size&#x2F;moment. I suspect these metrics are irrelevant to disproportionately more people reading this.<p>At any rate, for those of us who like to learn, I still found this valuable but by no means common knowledge
            • oivey50 minutes ago
              I&#x27;m not sure it&#x27;s common knowledge, but it is general knowledge. Not all HNers are writing web apps. Many may be writing truly compute bound applications.<p>In my experience writing computer vision software, people really struggle with the common sense of how fast computers really are. Some knowledge like how many nanoseconds an add takes can be very illuminating to understand whether their algorithm&#x27;s runtime makes any sense. That may push loose the bit of common sense that their algorithm is somehow wrong. Often I see people fail to put bounds on their expectations. Numbers like these help set those bounds.
          • cycomanic6 hours ago
            But these performance numbers are meaningless without some sort of standard comparison case. So if you measure that e.g. some string operation takes 100ns, how do you compare against the numbers given here? Any difference could be due to PC, python version or your implementation. So you have to do proper benchmarking anyway.
            • ehaliewicz210 minutes ago
              If your program does 1 million adds, but it takes significantly longer than 19 milliseconds, you can guess that something else is going on.
          • willseth6 hours ago
            You gauge with metrics and profiles, if necessary, and address as needed. You don’t scrutinize every line of code over whether it’s “reasonable” in advance instead of doing things that actually move the needle.
            • oivey6 hours ago
              These are the metrics underneath it all. Profiles tell you what parts are slow relative to others and time your specific implementation. How long should it take to sum together a million integers?
              • willseth6 hours ago
                It literally doesn’t matter unless it impacts users. I don’t know why you would waste time on non problems.
                • ehaliewicz27 minutes ago
                  There&#x27;s no instant where things start impacting users where they didn&#x27;t before.<p>&quot;Performance is something we should only think about when it&#x27;s too late&quot; is basically doomed to fail unless your problem is trivial and the perf never matters at all.<p>Not caring about performance until it&#x27;s a problem is how you get something like windows 11 explorer, where their best &quot;solution&quot; is a total hack like preloading, which has barely any performance benefit. If you actually care about performance all the way through, you get something like File Pilot.
                • oivey4 hours ago
                  No one is suggesting “wasting time on non problems.” You’re tilting at windmills.
    • amelius10 hours ago
      Yeah, if you hit limits just look for a module that implements the thing in C (or write it). This is how it was always done in Python.
      • ryandrake7 hours ago
        I am currently (as we type actually LOL) doing this exact thing in a hobby GIS project: Python got me a prototype and proof of concept, but now that I am scaling the data processing to worldwide, it is obviously too slow so I&#x27;m rewriting it (with LLM assistance) in C. The huge benefit of Python is that I have a known working (but slow) &quot;reference implementation&quot; to test against. So I know the C version works when it produces identical output. If I had a known-good Python version of past C, C++, Rust, etc. projects I worked on, it would have been most beneficial when it came time to test and verify.
      • willseth9 hours ago
        Sometimes it’s as simple as finding the hotspot with a profiler and making a simple change to an algorithm or data structure, just like you would do in any language. The amount of handwringing people do about building systems with Python is silly.
    • kc0bfv9 hours ago
      I agree - however, that has mostly been a feeling for me for years. Things feel fast enough and fine.<p>This page is a nice reminder of the fact, with numbers. For a while, at least, I will Know, instead of just feel, like I can ignore the low level performance minutiae.
  • sjducb6 hours ago
    It’s missing the time taken to instantiate a class.<p>I remember refactoring some code to improve readability, then observing something that was previously a few microseconds take tens of seconds.<p>The original code created a large list of lists. Each child list had 4 fields each field was a different thing, some were ints and one was a string.<p>I created a new class with the names of each field and helper methods to process the data. The new code created a list of instances of my class. Downstream consumers of the list could look at the class to see what data they were getting. Modern Python developers would use a data class for this.<p>The new code was very slow. I’d love it if the author measured the time taken to instantiate a class.
    • lifeisstillgood6 hours ago
      I went to the doctor and I said “It hurts when I do this”<p>The doctor said, “don’t do that”.<p>Edit: so yeah a rather snarky reply. Sorry. But it’s worth asking why we want to use classes and objects everywhere. Alan Kay is well known for saying object orientated is about message passing (mostly by Erlang people).<p>A list of lists (where each list is four different types repeated) seems a fine data structure, which can be operated on by external functions, and serialised pretty easily. Turning it into classes and objects might not be a useful refactoring, I would certainly want to learn more before giving the go ahead.
      • krior4 hours ago
        I mean it sounds reasonable to me to wrap the data into objects.<p>customers[3][4]<p>is a lot less readable than<p>customers[3].balance
        • lifeisstillgood3 hours ago
          Absolutely<p>But hidden in this is the failing of every sql-bridge ever - it’s definitely easier for a programmer to read customers(3).balance but the trade off now is I have to provide class based semantics for all operations - and that tends to hide (oh you know, impedance mismatch).<p>I would far prefer “store the records as plain as we can” and add on functions to operate over it (think pandas stores basically just ints floats and strings as it is numpy underneath)<p>(Yes you can store pyobjects somehow but the performance drops off a cliff.)<p>Anyway - keep the storage and data structure as raw and simple as possible and write functions to run over it. And move to pandas or SQLite pretty quickly :-)
    • smcin4 hours ago
      Instantiating classes is in general not a performance issue in Python. Your issue here strongly sounds like you&#x27;re abusing OO to pass a list of instances into every method and downstream call (not just the usual reference to self, the instance at hand). Don&#x27;t do that, it shouldn&#x27;t be necessary. It sounds like you&#x27;re trying to get a poor-man&#x27;s imitation of classmethods, without identifying and refactoring <i>whatever it is that methods might need to access from other instances</i>.<p>Please post your code snippet on StackOverflow ([python] tag) or CodeReview.SE so people can help you fix it.<p>&gt; <i>created a new class with the names of each field and helper methods to process the data. The new code created a list of instances of my class. Downstream consumers of the list could look at the class to see what data they were getting.</i>
  • robertclaus5 hours ago
    I liked reading through it from a &quot;is modern Python doing anything obviously wrong?&quot; perspective, but strongly disagree anyone should &quot;know&quot; these numbers. There&#x27;s like 5-10 primitives in there that everyone should know rough timings for; the rest should be derived with big-O algorithm and data structure knowledge.
  • f311a8 hours ago
    <p><pre><code> &gt; Strings &gt;The rule of thumb for strings is the core string object takes 41 bytes. Each additional character is 1 byte. </code></pre> That&#x27;s misleading. There are three types of strings in Python (1, 2 and 4 bytes per character).<p><a href="https:&#x2F;&#x2F;rushter.com&#x2F;blog&#x2F;python-strings-and-memory&#x2F;" rel="nofollow">https:&#x2F;&#x2F;rushter.com&#x2F;blog&#x2F;python-strings-and-memory&#x2F;</a>
  • riazrizvi10 hours ago
    The titles are oddly worded. For example -<p><pre><code> Collection Access and Iteration How fast can you get data out of Python’s built-in collections? Here is a dramatic example of how much faster the correct data structure is. item in set or item in dict is 200x faster than item in list for just 1,000 items! </code></pre> It seems to suggest an iteration <i>for x in mylist</i> is 200x slower than <i>for x in myset</i>. It’s the membership test that is much slower. Not the iteration. (Also <i>for x in mydict</i> is an iteration over keys not values, and so isn’t what we think of as an iteration on a dict’s ‘data’).<p>Also the overall title “Python Numbers Every Programmer Should Know” starts with 20 numbers that are merely interesting.<p>That all said, the formatting is nice and engaging.
  • perrygeo7 hours ago
    &gt; small int (0-256) cached<p>It&#x27;s -5 to 256, and these have very tricky behavior for programmers that confuse identity and equality.<p><pre><code> &gt;&gt;&gt; a = -5 &gt;&gt;&gt; b = -5 &gt;&gt;&gt; a is b True &gt;&gt;&gt; a = -6 &gt;&gt;&gt; b = -6 &gt;&gt;&gt; a is b False</code></pre>
    • Tostino2 hours ago
      Java does similar. Confusing for beginners who run into it for the first time for sure.
  • boerseth9 hours ago
    That&#x27;s a long list of numbers that seem oddly specific. Apart from learning that f-strings are way faster than the alternatives, and certain other comparisons, I&#x27;m not sure what I would use this for day-to-day.<p>After skimming over all of them, it seems like most &quot;simple&quot; operations take on the order of 20ns. I will leave with that rule of thumb in mind.
    • aunderscored5 hours ago
      If you&#x27;re interested, fstrings are faster because they directly become bytecode at compile time rather than being a function call at runtime
      • apelapan4 hours ago
        Thanks for the that bit of info! I was surprised by the speed difference. I have always assumed that most variations of basic string formatting would compile to the same bytecode.<p>I usually prefer classic %-formatting for readability when the arguments are longer and f-strings when the arguments are shorter. Knowing there is a material performance difference at scale, might shift the balance in favour of f-strings for some situations.
    • 0x000xca0xfe9 hours ago
      That number isn&#x27;t very useful either, it really depends on the hardware. Most virtualized server CPUs where e.g. Django will run on in the end are nowhere near the author&#x27;s M4 Pro.<p>Last time I benchmarked a VPS it was about the performance of an Ivy Bridge generation laptop.
      • giantrobot8 hours ago
        &gt; Last time I benchmarked a VPS it was about the performance of an Ivy Bridge generation laptop.<p>I have a number of Intel N95 systems around the house for various things. I&#x27;ve found them to be a pretty accurate analog for small instances VPSes. The N95 are Intel E-cores which are effectively Sandy Bridge&#x2F;Ivy Bridge cores.<p>Stuff can fly on my MacBook but than drag on a small VPS instance but validating against an N95 (I already have) is helpful. YMMV.
  • ZiiS10 hours ago
    This is really weird thing to worry about in python. But is also misleading; Python int is arbitrary precision, they can take up much more storage and arithmetic time depending in their value.
  • xnx10 hours ago
    Python programmers don&#x27;t need to know 85 different obscure performance numbers. Better to really understand ~7 general system performance numbers.
  • iamnotsure13 minutes ago
    Exactly wrong.
  • ktpsns10 hours ago
    Nice numbers and it&#x27;s always worth to know an order of magnitude. But these charts are far away from what &quot;every programmer should know&quot;.
    • jerf10 hours ago
      I think we can safely steelman the claim to &quot;every Python programmer should know&quot;, and even from there, every &quot;serious&quot; Python programmer, writing Python professionally for some &quot;important&quot; reason, not just everyone who picks up Python for some scripting task. Obviously there&#x27;s not much reason for a C# programmer to go try to memorize all these numbers.<p>Though IMHO it suffices just to know that &quot;Python is 40-50x slower than C and is bad at using multiple CPUs&quot; is not just some sort of anti-Python propaganda from haters, but a fairly reasonable engineering estimate. If you know that you don&#x27;t really need that chart. If your task can tolerate that sort of performance, you&#x27;re fine; if not, figure out early how you are going to solve that problem, be it through the several ways of binding faster code to Python, using PyPy, or by not using Python in the first place, whatever is appropriate for your use case.
  • sireat5 hours ago
    Interesting information but these are not hard numbers.<p>Surely the 100-char string information of 141 bytes is not correct as it would only apply to ASCII 100-char strings.<p>It would be more useful to know the overhead for unicode strings presumably utf-8 encoded. And again I would presume 100-Emoji string would take 441 bytes (just a hypothesis) and 100-umlaut chars string would take 241bytes.
  • pvtmert5 hours ago
    There are lots of discussions about relatedness of these numbers for a regular software engineer.<p>Firstly, I want to start with the fact that the base system is a macOS&#x2F;M4Pro, hence;<p>- Memory related access is <i>possibly</i> much faster than a x86 server. - Disk access is <i>possibly</i> much slower than a x86 server.<p>*) I took x86 server as the basis as most of the applications run on x86 Linux boxes nowadays, although a good amount of fingerprint is also on other ARM CPUs.<p>Although it probably does not change the memory footprint much, the libraries loaded and their architecture (ie. being Rosetta or not) will change the overall footprint of the process.<p>As it was mentioned on one of the sibling comments -&gt; Always inspect&#x2F;trace your own workflow&#x2F;performance before making assumptions. It all depends on specific use-cases for higher-level performance optimizations.
  • andai3 hours ago
    The one I noticed the most was import openai and import numpy.<p>They&#x27;re both about a full second on my old laptop.<p>I ended up writing my own simple LLM library just so I wouldn&#x27;t have to import OpenAI anymore for my interactive scripts.<p>(It&#x27;s just some wrapper functions around the equivalent of a curl request, which is honestly basically everything I used the OpenAI library for anyway.)
  • gcanyon3 hours ago
    As someone who most often works in a language that is literally orders of magnitude slower than this —- and has done so since CPU speeds were measured in double-digit megahertz —- I am crying at the notion that <i>anything</i> here is measured in nanoseconds
  • CmdrKrool5 hours ago
    I&#x27;m confused by this:<p><pre><code> String operations in Python are fast as well. f-strings are the fastest formatting style, while even the slowest style is still measured in just nano-seconds. Concatenation (+) 39.1 ns (25.6M ops&#x2F;sec) f-string 64.9 ns (15.4M ops&#x2F;sec) </code></pre> It says f-strings are fastest but the numbers show concatenation taking less time? I thought it might be a typo but the bars on the graph reflect this too?
  • tgv10 hours ago
    I doubt list and string concatenation operate in constant time, or else they affect another benchmark. E.g., you can concatenate two lists in the same time, regardless of their size, but at the cost of slower access to the second one (or both).<p>More contentiously: don&#x27;t fret too much over performance in Python. It&#x27;s a slow language (except for some external libraries, but that&#x27;s not the point of the OP).
    • jerf10 hours ago
      String concatenation is mentioned twice on that page, with the same time given. The first time it has a parenthetical &quot;(small)&quot;, the second time doesn&#x27;t have it. I expect you were looking at the second one when you typed that as I would agree that you can&#x27;t just label it as a constant time, but they do seem to have meant concatenating &quot;small&quot; strings, where the overhead of Python&#x27;s object construction would dominate the cost of the construction of the combined string.
  • snakepit6 hours ago
    This is helpful. Someone should create a similar benchmark for the BEAM. This is also a good reminder to continue working on snakepit [1] and snakebridge [2]. Plenty remains before they&#x27;re suitable for prime time.<p>[1] <a href="https:&#x2F;&#x2F;hex.pm&#x2F;packages&#x2F;snakepit" rel="nofollow">https:&#x2F;&#x2F;hex.pm&#x2F;packages&#x2F;snakepit</a> [2] <a href="https:&#x2F;&#x2F;hex.pm&#x2F;packages&#x2F;snakebridge" rel="nofollow">https:&#x2F;&#x2F;hex.pm&#x2F;packages&#x2F;snakebridge</a>
  • mikeckennedy9 hours ago
    Author here.<p>Thanks for the feedback everyone. I appreciate your posting it @woodenchair and @aurornis for pointing out the intent of the article.<p>The idea of the article is NOT to suggest you should shave 0.5ns off by choosing some dramatically different algorithm or that you really need to optimize the heck out of everything.<p>In fact, I think a lot of what the numbers show is that over thinking the optimizations often isn&#x27;t worth it (e.g. caching len(coll) into a variable rather than calling it over and over is less useful that it might seem conceptually).<p>Just write clean Python code. So much of it is way faster than you might have thought.<p>My goal was only to create a reference to what various operations cost to have a mental model.
    • willseth8 hours ago
      Then you should have written that. Instead you have given more fodder for the premature optimization crowd.
      • mikeckennedy4 hours ago
        I didn&#x27;t tell anyone to optimize anything. I just posted numbers. It&#x27;s not my fault some people are wired that way. Anytime I suggested some sort of recommendation it was to NOT optimize.<p>For example, from the post &quot;Maybe we don’t have to optimize it out of the test condition on a while loop looping 100 times after all.&quot;
  • jchmbrln10 hours ago
    What would be the explanation for an int taking 28 bytes but a list of 1000 ints taking only 7.87KB?
    • wiml9 hours ago
      That appears to be the size of the list itself, not including the objects it contains: 8 bytes per entry for the object pointer, and a kilo-to-kibi conversion. All Python values are &quot;boxed&quot;, which is probably a more important thing for a Python programmer to know than most of these numbers.<p>The list of floats is larger, despite also being simply an array of 1000 8-byte pointers. I assume that it&#x27;s because the int array is constructed from a range(), which has a __len__(), and therefore the list is allocated to exactly the required size; but the float array is constructed from a generator expression and is presumably dynamically grown as the generator runs and has a bit of free space at the end.
      • lopuhin7 hours ago
        That&#x27;s impressive how you figured out the reason for the difference in list of floats vs list of ints container size, framed as an interview question that would have been quite difficult I think
      • mikeckennedy7 hours ago
        It was. I updated the results to include the contained elements. I also updated the float list creation to match the int list creation.
  • oogali10 hours ago
    It&#x27;s important to know that these numbers will vary based on what you&#x27;re measuring, your hardware architecture, and how your particular Python binary was built.<p>For example, my M4 Max running Python 3.14.2 from Homebrew (built, not poured) takes 19.73MB of RAM to launch the REPL (running `python3` at a prompt).<p>The same Python version launched on the same system with a single invocation for `time.sleep()`[1] takes 11.70MB.<p>My Intel Mac running Python 3.14.2 from Homebrew (poured) takes 37.22MB of RAM to launch the REPL and 9.48MB for `time.sleep`.<p>My number for &quot;how much memory it&#x27;s using&quot; comes from running `ps auxw | grep python`, taking the value of the resident set size (RSS column), and dividing by 1,024.<p>1: python3 -c &#x27;from time import sleep; sleep(100)&#x27;
  • calmbonsai6 hours ago
    You absolutely <i>do not</i> need to know those absolute numbers--only the relative costs of various operations.<p>Additionally, regardless of the code you can profile the system to determine where the &quot;hot spots&quot; are and refactor or call-out to more performant (Rust, Go, C) run-times for those workflows where necessary.
  • rozab2 hours ago
    I wonder why an empty set takes so much more memory than an empty dict
  • nodja5 hours ago
    I think a lot of commenters here are missing the point.<p>Looking at performance numbers is important regardless if it&#x27;s python, assembly or HDL. If you don&#x27;t understand why your code is slow you can always look at how many cycles things take and learn to understand how code works at a deeper level, as you mature as a programmer things will become obvious, but going through the learning process and having references like these will help you to get there sooner, seeing the performance numbers and asking why some things take much longer—or sometimes why they take the exact same time—is the perfect opportunity to learn.<p>Early in my python career I had a python script that found duplicate files across my disks, the first iteration of the script was extremely slow, optimizing the script went through several iterations as I learned how to optimize at various levels. None of them required me to use C. I just used caching, learned to enumerate all files on disk fast, and used sets instead of lists. The end result was that doing subsequent runs made my script run in 10 seconds instead of 15 minutes. Maybe implementing in C would make it run in 1 second, but if I had just assumed my script was slow because of python then I would&#x27;ve spent hours doing it in C only to go from 15 minutes to 14 minutes and 51 seconds.<p>There&#x27;s an argument to be made that it would be useful to see C numbers next to the python ones, but for the same reason people don&#x27;t just tell you to just use an FPGA instead of using C, it&#x27;s also rude to say python is the wrong tool when often it isn&#x27;t.
  • esafak7 hours ago
    The point of the original list was that the numbers were simple enough to memorize: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;jboner&#x2F;2841832" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;jboner&#x2F;2841832</a><p>Nobody is going to remember any of the numbers on this new list.
    • mikeckennedy4 hours ago
      That&#x27;s a fair point @esafak. I updated the article with something akin to the doubling chart of numbers in the original article from 2012.
  • Redoubts3 hours ago
    &gt; Attribute read (obj.x) 14 ns<p>note that protobuf attributes are 20-50x worse than this
  • charlieyu14 hours ago
    Surprised that list comprehensions are only 26% faster than for loops. It used to feel like 4-5x
  • JBits5 hours ago
    One of the reasons I&#x27;m really excited about JAX is that I hope it will allow me to write fast Python code without worrying about these details.
  • mwkaufma9 hours ago
    Why? If those micro benchmarks mattered in your domain, you wouldn&#x27;t be using python.
    • coldtea9 hours ago
      That&#x27;s an &quot;all or nothing&quot; fallacy. Just because you use Python and are OK with some slowdown, doesn&#x27;t mean you&#x27;re OK with each and every slowdown when you can do better.<p>To use a trivial example, using a set instead of a list to check membership is a very basic replacement, and can dramatically improve your running time in Python. Just because you use Python doesn&#x27;t mean anything goes regarding performance.
      • mwkaufma9 hours ago
        That&#x27;s an example of an algorithmic improvement (log n vs n), not a micro benchmark, Mr. Fallacy.
        • coldtea4 hours ago
          &quot;Mr. Fallacy.&quot;? Got any better juvenile name-calling?<p>The case is among the example numbers given in TFA:<p>&quot;Dict lookup by key&quot;, &quot;List membership check&quot;<p>Does it have to spell out the difference is algorithmic in this case for the comparison to be useful?<p>Or, inversely, is the difference between e.g. memory and disk access times insignificant, because it&#x27;s not algorithmic?
    • PhilipRoman7 hours ago
      ...and other hilarious jokes you can tell yourself!
  • mopsi1 hour ago
    It is always a good idea to have at least a rough understanding of how much operations in your code cost, but sometimes very expensive mistakes end up in non-obvious places.<p>If I have only plain Python installed and a .py file that I want to test, then what&#x27;s the easiest way to get a visualization of the call tree (or something similar) and the computational cost of each item?
  • dr_kretyn10 hours ago
    Initially I thought how efficient strings are... but then I understood how inefficient arithmetic is. Interesting comparison but exact speed and IO depend on a lot of things, and unlikely one uses Mac mini in production so these numbers definitely aren&#x27;t representative.
  • lunixbochs7 hours ago
    I&#x27;m confused why they repeatedly call a slots class larger than a regular dict class, but don&#x27;t count the size of the dict
  • belabartok397 hours ago
    Hmmmm, there should absolutely be standard deviations for this type of work. Also, what is N number of runs? Does it say somewhere?
    • mikeckennedy5 hours ago
      It is open source, you could just look. :) But here is a summary for you. It&#x27;s not just one run and take the number:<p>Benchmark Iteration Process<p>Core Approach:<p>- Warmup Phase: 100 iterations to prepare the operation (default)<p>- Timing Runs: 5 repeated runs (default), each executing the operation a specified number of times<p>- Result: Median time per operation across the 5 runs<p>Iteration Counts by Operation Speed: - Very fast ops (arithmetic): 100,000 iterations per run<p>- Fast ops (dict&#x2F;list access): 10,000 iterations per run<p>- Medium ops (list membership): 1,000 iterations per run<p>- Slower ops (database, file I&#x2F;O): 1,000-5,000 iterations per run<p>Quality Controls:<p>- Garbage collection is disabled during timing to prevent interference<p>- Warmup runs prevent cold-start bias<p>- Median of 5 runs reduces noise from outliers<p>- Results are captured to prevent compiler optimization elimination<p>Total Executions: For a typical benchmark with 1,000 iterations and 5 repeats, each operation runs 5,100 times (100 warmup + 5×1,000 timed) before reporting the median result.
      • belabartok395 hours ago
        That answers what N is (why not just say in the article). If you are only going to report medians, is there an appendix with further statistics such as confidence intervals or standard deviations. For serious benchmark, it would be essential to show the spread or variability, no?
  • woodruffw10 hours ago
    Great reference overall, but some of these will diverge in practice: 141 bytes for a 100 char string won’t hold for non-ASCII strings for example, and will change if&#x2F;when the object header overhead changes.
  • Retr0id8 hours ago
    &gt; Numbers are surprisingly large in Python<p>Makes me wonder if the cpython devs have ever considered v8-like NaN-boxing or pointer stuffing.
  • Y_Y10 hours ago
    int is larger than float, but list of floats is larger than list of ints<p>Then again, if you&#x27;re worried about any of the numbers in this article maybe you shouldn&#x27;t be using Python at all. I joke, but please do at least use Numba or Numpy so you aren&#x27;t paying huge overheads for making an object of every little datum.
  • jiggawatts2 hours ago
    My god, the memory bloat is out of this world compared to platforms like the JVM or .NET, let alone C++ or Rust!
  • m30477 hours ago
    +1 but I didn&#x27;t see pack &#x2F; unpack...
  • lcnmrn7 hours ago
    LLMs can improve Python code performance. I used it myself on a few projects.
  • zbentley8 hours ago
    I have some questions and requests for clarification&#x2F;suspicious behavior I noticed after reviewing the results and the benchmark code, specifically:<p>- If slotted attribute reads and regular attribute reads are the same latency, I suspect that either the regular class may not have enough &quot;bells on&quot; (inheritance&#x2F;metaprogramming&#x2F;dunder overriding&#x2F;etc) to defeat simple optimizations that cache away attribute access, thus making it equivalent in speed to slotted classes. I know that over time slotting will become less of a performance boost, but--and this is just my intuition and I may well be wrong--I don&#x27;t get the impression that we&#x27;re there yet.<p>- Similarly &quot;read from @property&quot; seems suspiciously fast to me. Even with descriptor-protocol awareness in the class lookup cache, the overhead of calling a method seems surprisingly similar to the overhead of accessing a field. That <i>might</i> be explained away by the fact that property descriptors&#x27; &quot;get&quot; methods are guaranteed to be the simplest and easiest to optimize of all call forms (bound method, guaranteed to never be any parameters), and so the overhead of setting up the stack&#x2F;frame&#x2F;args may be substantially minimized...but that would only be true if the property&#x27;s method body was &quot;return 1&quot; or something very fast. The properties tested for these benchmarks, though, are looking up other fields on the class, so I&#x27;d expect them to be a <i>lot</i> slower than field access, not just a little slower (<a href="https:&#x2F;&#x2F;github.com&#x2F;mikeckennedy&#x2F;python-numbers-everyone-should-know&#x2F;blob&#x2F;main&#x2F;code&#x2F;attributes&#x2F;other_ops.py#L32C7-L32C24" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mikeckennedy&#x2F;python-numbers-everyone-shou...</a>).<p>- On the topic of &quot;access fields of objects&quot; (properties&#x2F;dataclasses&#x2F;slots&#x2F;MRO&#x2F;etc.), benchmarks are really hard to interpret--not just these benchmarks, all of them I&#x27;ve seen. That&#x27;s because there are fundamentally two operations involved: <i>resolving</i> a field to something that produces data for it, and then <i>accessing</i> the data. For example, a @property is in a class&#x27;s method cache, so resolving &quot;instance.propname&quot; is done at the speed of the methcache. That might be faster than accessing &quot;instance.attribute&quot; (a field, not a @property or other descriptor), depending on the inheritance geometry in play, slots, __getattr[ibute]__ overrides, and so on. On the other hand, <i>accessing</i> the data at &quot;instance.propname&quot; is going to be a <i>lot</i> more expensive for most @properties (because they need to call a function, use an argument stack, and usually perform other attribute lookups&#x2F;call other functions&#x2F;manipulate locals, etc); accessing data at &quot;instance.attribute&quot; is going to be fast and constant-time--one or two pointer-chases away at most.<p>- Nitty: why&#x27;s pickling under file I&#x2F;O? Those benchmarks aren&#x27;t timing pickle functions that perform IO, they&#x27;re benchmarking the ser&#x2F;de functionality and thus should be grouped with json&#x2F;pydantic&#x2F;friends above.<p>- Asyncio&#x27;s no spring chicken, but I think a lot of the benchmarks listed tell a worse story than necessary, because they don&#x27;t distinguish between coroutines, Tasks, and Futures. Coroutines are cheap to have and call, but Tasks and Futures have a little more overhead when they&#x27;re used (even fast CFutures) and a <i>lot</i> more overhead to construct since they need a lot more data resources than just a generator function (which is <i>kinda</i> what a raw coroutine desugars to, but that&#x27;s not as true as most people think it is...another story for another time). Now, &quot;run_until_complete{}&quot; and &quot;gather()&quot; initially take their arguments and coerce them into Tasks&#x2F;Futures--that detection, coercion, and construction takes time and consumes a lot of overhead. That&#x27;s good to know (since many people are paying that coercion tax unknowingly), but it muddies the boundary between &quot;overhead of waiting for an asyncio operation to complete&quot; and &quot;overhead of starting an asyncio operation&quot;. Either calling the lower-level functions that run_until_complete()&#x2F;gather() use internally, or else separating out benchmarks into ones that pass Futures&#x2F;Tasks&#x2F;regular coroutines might be appropriate.<p>- Benchmarking &quot;asyncio.sleep(0)&quot; as a means of determining the bare-minimum await time of a Python event loop is a bad idea. sleep(0) is very special (more details here: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46056895">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46056895</a>) and not representative. To benchmark &quot;time it takes for the event loop to spin once and produce a result&quot;&#x2F;the python equivalent of process.nextTick, it&#x27;d be better to use low-level loop methods like &quot;call_soon&quot; or defer completion to a Task and await that.
  • 867-530910 hours ago
    tfa mentions running benchmark on a multi-core platform, but doesn&#x27;t mention if benchmark results used multithreading.. a brief look at the code suggests not
  • _ZeD_10 hours ago
    Yeah... No. I&#x27;ve 10+ years of python under my belt and I might have had need for this kind of micro optimizations in like 2 times most
    • willseth7 hours ago
      Sorry, you’re not allowed to discourage premature optimization or defend Python here.
  • ewuhic9 hours ago
    This is AI slop.