-
Notifications
You must be signed in to change notification settings - Fork 778
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
improve performance of successful int extract by ~30% by avoiding calls to __index__
where redundant
#3742
improve performance of successful int extract by ~30% by avoiding calls to __index__
where redundant
#3742
Conversation
CodSpeed Performance ReportMerging #3742 will degrade performances by 18.05%Comparing Summary
Benchmarks breakdown
|
Nice! It looks like this code might have originated from discussion in #108. I think that logic is likely extremely dated and we're now right to simplify here. |
python/cpython#80229 looks relevant, which was in 3.8 so we may need to keep a different path for 3.7. |
4a97ccb
to
206fb59
Compare
Logic changed for 3.8 to just call I haven't changed the extraction logic for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current patch looks good, though I think the same thing needs to be added also around line 70 in the int_convert_u64_or_i64
macro?
Also once that's added, please force-push to squash; GitHub merge queue doesn't let us choose to squash-merge.
Uff unfortunately the test failure looks legitimate, |
6b02537
to
d13e735
Compare
__index__
where redundant
turns out the benchmarks extract a lot of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess both usize
and u64
are the standard type in the benchmarks, yes 😂
This looks great to me, perhaps just can you squash it please? Then let's merge 🚀
d13e735
to
8652664
Compare
squashed |
The full build suggests that 3.8 logic isn't quite right. I've added the label now so if you push further here it'll run without going to the merge queue... |
Looks like this will fail, I think the lossy float conversion wasn't fixed until 3.10 in python/cpython#82180. |
716d472
to
38c96d9
Compare
add newsfragment formatting skip slow path on 3.8+ formatting cfg if,else formatting again dedicated macro, change int_convert_u64_or_i64 too add float tests force index call for PyLong_AsUnsignedLongLong perform PyLong check for 3.8 too perform PyLong check for <3.10
38c96d9
to
0e876d9
Compare
Ok great; so now we can do the fast-path on 3.10+ instead. Makes sense. |
I'm assuming the segmentation fault with numpy on the merge queue is not something for me to fix? |
Nope; rerun succeeded. There is some known flakiness on PyPy that I believe to be between them and pytest, we're just an unhappy casualty of it. |
Results from benchmarks:
🚀