|
|
Log in / Subscribe / Register

Modifying the Python object model

Modifying the Python object model

Posted May 17, 2018 15:55 UTC (Thu) by excors (subscriber, #95769)
Parent article: Modifying the Python object model

> Shapiro may not be aware that the Python core developers have often preferred simpler, more understandable code that is easier to read and follow, over more complex algorithms and data structures in the interpreter. Some performance may well have been sacrificed for readability.

Surely the point of writing readable code is to make it easy to come back later and modify it, not to just put it in a glass case and admire its static perfection. But if you adhere so strongly to readability that you reject any attempts to improve the code out of fear they will increase its complexity, then you've destroyed the benefits of that readability.

It's kind of the opposite of technical debt - you've spent a lot of effort building up technical credit by keeping the code readable, but that effort is wasted unless you eventually spend the credit on valuable features or performance. Obviously there's a danger of spending too much and going back into debt, but you shouldn't ignore the danger of spending too little.


to post comments

Modifying the Python object model

Posted May 19, 2018 12:17 UTC (Sat) by quotemstr (subscriber, #45331) [Link] (2 responses)

Right. One can come up with an infinity of good-sounding excuses for what's really a "culture of no" and a pervasive sense of stasis and paralysis. I applaud this work on the Python interpreter and hope the cpython core adopts at least some of it. Lookup caching is a huge win.

Modifying the Python object model

Posted May 19, 2018 20:42 UTC (Sat) by robert_s (subscriber, #42402) [Link] (1 responses)

I really don't understand why he didn't perform his analysis on PyPy, where any performance "quick wins" he found would have been lapped up. The two projects have different goals.

Modifying the Python object model

Posted May 21, 2018 3:38 UTC (Mon) by gps (subscriber, #45638) [Link]

PyPy is not always feasible for large existing CPython applications because they rely on the CPython API for tons of C/C++ extensions. The pypy C API emulation layer, even when up to the task, kills performance and increases pypy's already high memory overhead.

YouTube investigated using pypy. The experiments concluded that it just wasn't going to be a win compute resource wise even before counting the additional "different runtime" long term maintenance burden it would require.

PyPy has a lot of good ideas. It is a great place to experiment with fun internals changes but isn't practical for many things not already written to use it from the start.


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