LWN: Comments on "Faster CPython at PyCon, part one" https://lwn.net/Articles/930705/ This is a special feed containing comments posted to the individual LWN article titled "Faster CPython at PyCon, part one". en-us Fri, 05 Sep 2025 07:35:00 +0000 Fri, 05 Sep 2025 07:35:00 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Faster CPython at PyCon, part one https://lwn.net/Articles/931846/ https://lwn.net/Articles/931846/ massimiliano <div class="FormattedComment"> If you want to see state-of-the-art dynamic opcode specialization look at what V8 (the Chrome Javascript VM) has been doing for more than one decade :-)<br> </div> Mon, 15 May 2023 10:07:27 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931780/ https://lwn.net/Articles/931780/ gps <div class="FormattedComment"> When continual invariant checking would be overwhelming, another approach is commonly used: assume invariants are true but record all state changes in a way that can be undone. So you proceed with some execution and do the invariant check before any point that would force you to commit and expose your state change to the broader system in a way that cannot be rolled back. In the rare case those invariant checks fail, you back out all uncommitted state changes from that piece of execution and take the slow invariant handling path. If it fails often, you flag that bit of code and don't run such a state assuming aggressive JIT translation on that part in the future.<br> <p> I don't know how feasible this approach is for a high level language, but it has been implemented time and time again in JIT/translation-like systems over the past several decades.<br> <p> We did this in Transmeta's CMS (code morphing software) that implemented x86, but that was obviously much lower level and on hardware designed for the purpose.<br> </div> Fri, 12 May 2023 19:03:09 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931700/ https://lwn.net/Articles/931700/ Wol <div class="FormattedComment"> I doubt they'll go down this road, but ...<br> <p> Interpreted VM code is also known as p-code, no? And I know of at least two CPUs that were designed (Pascal) or modified (50-series) to execute p-code directly :-)<br> <p> Isn't that also pretty much a description of CRISC systems?<br> <p> Cheers,<br> Wol<br> </div> Fri, 12 May 2023 07:23:14 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931697/ https://lwn.net/Articles/931697/ ebwb <div class="FormattedComment"> I always feel delighted when I see it. Sometimes it's nice to have a bit of feedback from a different, perhaps atypical channel as to where my funding helps support LWN's work. <br> <p> Maybe they literally mean to thank you, me, and all of us! Surely there are some conferences the individual LWN staff members wouldn't be able to attend were it not for their work, so they are expressing gratitude for the fact that we're all here making it happen for those individuals.<br> </div> Fri, 12 May 2023 05:26:26 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931661/ https://lwn.net/Articles/931661/ anton One step between interpreted virtual-machine (VM) code and native code ("emmitting asm") is dynamic superinstructions (aka selective inlining). Combining this with quickening <a href="http://www.complang.tuwien.ac.at/papers/ertl+06dotnet.ps.gz">is non-trivial, but possible</a>. Having multiple alternative quickened superinstructions, and switching back to the slow variant, and then to a different quickened superinstruction is not covered in that paper, but I think it's possible. Thu, 11 May 2023 17:24:35 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931571/ https://lwn.net/Articles/931571/ kpfleming <div class="FormattedComment"> Except in Python the 'emitted asm' still has to check that the necessary invariants have not changed; dynamic languages make this much more difficult than otherwise. At some point if the 'invariant checking' code is large enough, inlining it in every location where the JIT has turned the code into 'emitted asm' will have its own costs (memory pressure, caching, etc.)<br> </div> Thu, 11 May 2023 11:56:28 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931549/ https://lwn.net/Articles/931549/ jake <div class="FormattedComment"> <span class="QuotedText">&gt; You're welcome. That's why we support LWN, to cover its expenses and provide its staff with an </span><br> <span class="QuotedText">&gt; income. That is all pretty obvious. So why did you feel the need to add this to this article?</span><br> <p> We put those on articles in part to remind others, who may not be subscribers, that it does cost money to do all of this stuff. And of course to thank folks like you.<br> <p> FWIW, we do generally get free tickets to conferences, either because we are speaking or because we ask for a press pass (as with PyCon). Press passes are pretty normal for tech (and other) journalism. We presumably could not go to as many conferences without them.<br> <p> jake<br> </div> Thu, 11 May 2023 00:15:29 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931540/ https://lwn.net/Articles/931540/ kleptog <div class="FormattedComment"> I first heard of this trick of specialising opcodes with respect to the Erlang VM. The interesting thing is that this is a step in the direction of a JIT. Namely, once you can recognise that all the instructions in a loop are specialised versions, it's but a small step to emitting asm code directly.<br> </div> Wed, 10 May 2023 21:48:46 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931539/ https://lwn.net/Articles/931539/ pebolle <div class="FormattedComment"> <span class="QuotedText">&gt; Possibly this is written in this way so that it can be shown that this wasn't a cost-free attendance funded by the conference giver in return for a favourable review.</span><br> <p> Yes, that's a murky area. I'm not sure what to think here. Is it OK for the press to accept free entrance to expensive conferences?<br> <p> But the disclaimer only mentioned travel, which I think is a pretty obvious expense for LWN. Actually, I'm totally OK with whatever LWN decides to spend our contributions on. Free champagne and caviar for its staff? Fine with me.<br> </div> Wed, 10 May 2023 21:43:48 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931538/ https://lwn.net/Articles/931538/ pebolle <div class="FormattedComment"> <span class="QuotedText">&gt; IRC this was prompted by questions from readers before on whether sponsorship is involved and in some cases, the answer is yes.</span><br> <p> But apparently no sponsorship was involved. So why bother with this message here?<br> Otherwise every article might end with:<br> <p> [I would like to thank LWN subscribers for funding the device I've written this article on and the purchase of literature I consulted while researching this article.]<br> <p> Yes, we know. That's why we support you. <br> <p> </div> Wed, 10 May 2023 21:31:44 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931537/ https://lwn.net/Articles/931537/ rahulsundaram <div class="FormattedComment"> <span class="QuotedText">&gt; You're welcome. That's why we support LWN, to cover its expenses and provide its staff with an income. That is all pretty obvious. So why did you feel the need to add this to this article?</span><br> <p> It looks like it is done to distinguish it from articles written where some other entity is sponsoring the travel. As an example, <a href="https://lwn.net/Articles/637211/">https://lwn.net/Articles/637211/</a> has this note instead:<br> <p> [I would like to thank the Linux Foundation for travel support to Boston for the summit.]<br> <p> IIRC this was prompted by questions from readers before on whether sponsorship is involved and in some cases, the answer is yes.<br> </div> Wed, 10 May 2023 21:15:12 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931536/ https://lwn.net/Articles/931536/ amacater <div class="FormattedComment"> Possibly this is written in this way so that it can be shown that this wasn't a cost-free attendance funded by the conference giver in return for a favourable review.<br> </div> Wed, 10 May 2023 21:12:16 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931533/ https://lwn.net/Articles/931533/ pebolle <div class="FormattedComment"> <span class="QuotedText">&gt; [I would like to thank LWN subscribers for supporting my travel to Salt Lake City for PyCon.] </span><br> <p> You're welcome. That's why we support LWN, to cover its expenses and provide its staff with an income. That is all pretty obvious. So why did you feel the need to add this to this article?<br> </div> Wed, 10 May 2023 20:26:14 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931489/ https://lwn.net/Articles/931489/ Wol <div class="FormattedComment"> <span class="QuotedText">&gt; That gives you current "master" compared to 3.11</span><br> <p> Is that "Python for Workgroups"?<br> <p> (G, d &amp; r)<br> <p> Cheers,<br> Wol<br> </div> Wed, 10 May 2023 13:22:23 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931452/ https://lwn.net/Articles/931452/ Twirrim <div class="FormattedComment"> Not precisely yet, but <a href="https://speed.python.org/comparison/">https://speed.python.org/comparison/</a> can help you compare against latest branch of master<br> <p> <a href="https://speed.python.org/comparison/?exe=12%2BL%2B3.11%2C12%2BL%2Bmaster&amp;ben=741%2C742%2C743%2C744%2C745%2C746%2C747%2C748%2C749%2C799%2C800%2C750%2C751%2C802%2C752%2C753%2C754%2C755%2C756%2C757%2C758%2C759%2C760%2C761%2C762%2C763%2C764%2C765%2C766%2C767%2C768%2C769%2C770%2C771%2C772%2C773%2C774%2C775%2C776%2C777%2C778%2C779%2C780%2C781%2C782%2C783%2C784%2C785%2C786%2C788%2C787%2C789%2C790%2C791%2C792%2C793%2C794%2C797%2C796%2C795%2C798&amp;env=1&amp;hor=true&amp;bas=12%2BL%2B3.11&amp;chart=normal+bars">https://speed.python.org/comparison/?exe=12%2BL%2B3.11%2C...</a> is my best attempt to do comparisons. That gives you current "master" compared to 3.11, using normalised against the latter.<br> </div> Wed, 10 May 2023 13:04:07 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931443/ https://lwn.net/Articles/931443/ jpfrancois <div class="FormattedComment"> Are there any benchmark number available that would illustrate these performance improvements for 3.11 and 3.12 ?<br> </div> Wed, 10 May 2023 08:50:15 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931441/ https://lwn.net/Articles/931441/ dureuill <div class="FormattedComment"> To my knowledge it doesn't: type annotations are not used at runtime. Plus, nothing at runtime prevents a user from calling such an annotated function with the wrong types anyway.<br> </div> Wed, 10 May 2023 06:43:30 +0000 Faster CPython at PyCon, part one https://lwn.net/Articles/931438/ https://lwn.net/Articles/931438/ tchernobog <div class="FormattedComment"> Does anybody know if specifying type annotations such as floats are able to skip the adaptive instructions and go to their specialized counterparts directly?<br> </div> Wed, 10 May 2023 06:37:08 +0000