New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method cache #44760
Comments
This is a port of PyPy's method cache optimization. It gives a very good speed-up to PyPy, and it is simple enough to be attempted on CPython. The patch is against Python 2.4, which is the version I still use; I've applied the patch on the system-wide Pythons of a couple of machines a few days ago and haven't had any problem since. It gives a consistent 20+% of speed-up on all applications and benchmarks I tried, and up to 36% in extreme OO examples like the "richards" benchmark. The patch needs to be ported to the HEAD, and it needs some extra careful review. I'm a bit too busy right now to do any of these but I'll eventually come back to it if nobody else does. |
Perhaps Raymond, as one of the optimization specialists, can have a look in the meantime? |
Yes, I've got it from here. |
I've done some work on this patch, including porting it to HEAD, streamlining some aspects for comprehensibility, and verifying correctness. My performance results are a little less dramatic, ranging from 10% speed up for simple non-heavy OO code to about 25% for applications with deeper object hierarchies. Given the very attractive speed up, I'm happy to continue along this patch, but have a few questions for both Raymond and Armin:
|
About 4.: type_modified() calls are needed when either the mro or the dictionary of any type along the mro is modified. I guess that an example can be built with a class X, where X().__module__ is read twice but X.__module__ modified inbetween. |
Thanks for the reminder, Armin. I've been focusing on verifying correctness for cached unbound methods, not all attributes. I'll re-review for that more general case. |
Also, if you've updated the patch to apply to the head, please upload it to SF so I won't have to do the same thing. |
Patch relative to current SVN HEAD uploaded as bpo-1700288. |
I'm working on this one this week. |
Superseded by bpo-1700288, which is updated for 2.6. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: