ENH: add cpp based uniform histogram calculation for optimization#31521
Draft
JosephMehdiyev wants to merge 7 commits into
Draft
ENH: add cpp based uniform histogram calculation for optimization#31521JosephMehdiyev wants to merge 7 commits into
JosephMehdiyev wants to merge 7 commits into
Conversation
A new helper method and some helper functions are added. This should make histogram fast path significantly faster. This optimization is only for the uniform edges
Previously it would just go for the slow path.
Contributor
Author
|
Hey @seberg, can we discuss about this PR in your free time if possible? You had a comment on the old PR. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #9910
PR summary
This PR makes the fast path of the histogram significantly fast. The current benchmark vs main:
histogramwould not go fast path for long doubleOther comments
I want to discuss this with someone experienced before I refine, implement the logic further into multidimensional case (for histogramdd). I tried to make the code look like other C files as much as possible (not sure if its smart thing to do)
I also feel like histogram deserves a couple of more benchmarks (especially for the slow path)
AI Disclosure
Claude was used as an AI tool.
Some parts (e.g template bodies) are written by me, some are recycled from the old python code, some are recycled from old PR (e.g error handling, numpy API etc) and some are written by AI (especially the weight type parts) and reviewed manually.
AI was also used extensively on Numpy API/Cpython specific parts, in parallel I have read some documentation and checked if I used them correctly, so be warned