-
Notifications
You must be signed in to change notification settings - Fork 22
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
Unexpectedly slow class method calls #226
Comments
Thank you for reporting this, I'll take a look. My initial suspicion is that we have some naive code that asserts the type of the |
Yup, so a trace confirmed all the time is spent doing an import then isinstance check on the self parameter. I've put up a PR #228 that seems to fix it. With optimize=Debug:
I'll try to put up a proper fix to this (which I believe to be #227) tomorrow sometime. |
Calling a class method is unexpectedly much slower (10-20x) than calling a function. This is not observed with comparable Cython code, so not an issue with Python class in C extensions.
pydust: calling function is fast (compiled with "zig build -Doptimize=ReleaseFast")
Calling class method is slow:
Code: diff against fresh checkout of ziggy-pydust-template:
Same thing done with Cython - same performance for function and method call:
The text was updated successfully, but these errors were encountered: