|
|
Subscribe / Log in / New account

Where does the speedup come from? And my own experiences

Where does the speedup come from? And my own experiences

Posted Feb 27, 2025 13:48 UTC (Thu) by daroc (editor, #160859)
In reply to: Where does the speedup come from? And my own experiences by mathstuf
Parent article: Python interpreter adds tail calls

Well, that paragraph is about how to avoid the overhead from splitting the interpreter out into more smaller functions, which the computed-goto-based version doesn't have.

As for whether I've attributed the performance improvements to the right things in the article — modern performance is complicated. The above description is synthesized from the discussion between the Python developers about the rationale and effects of the change; it makes sense to me, based on my understanding of compiler optimization pipelines, but it is entirely possible that both they and I are mistaken about the deeper causes here.

In particular, I think that the LTO comment can make sense — as mentioned, GCC and Clang have limits on how large a function they're willing to create by inlining things. By breaking the interpreter up into smaller functions, you have more opportunities to inline the other functions in the Python codebase that each instruction calls, and then optimize those in context.

Perhaps as the Faster CPython project keeps working on these things we'll see a more detailed performance breakdown that could shed some light on the matter.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds