4 ms·
Errr, did the article change since you read it? "At Magnetic, we’ve switched from running all of our performance-sensitive Python code from CPython to PyPy, so
by jerf 12y ago
Errr, did the article change since you read it?
"At Magnetic, we’ve switched from running all of our performance-sensitive Python code from CPython to PyPy, so let’s consider whether these code optimizations are still appropriate... PyPy is incredibly fast, around an order of magnitude faster than CPython in this benchmark. Because PyPy performs more advanced optimizations than CPython, including many optimizations for classes and methods, the timings for the class vs. closure implementations are a statistical tie."
- elyase 12y agoWhy I said is that I would go directly to pypy and related, without first trying to optimize like they did in Python world. They guys at Magnetic came to same conclusion in the end: "Curiously, the function implementation is actually slower than the class approach in PyPy." I don't find this surprising anymore because it is what almost always happens in my code.
- jerf 12y agoAh! That makes sense. Thank you.
- gknoy 12y agoI think the techniques discussed here have value, pedagogical and otherwise. Perhaps one is working on a codebase where we don't have the luxury to move to pypy or similar (e.g., my current one which uses some incompatible libraries, so transition would be nontrivial). The fact that that method accessors are much slower than properties, or that closures can speed things up, is something that we might not always be mindful of, and that new python programmers might not think through.