PERF: skip copyto mask conversion for where=True#31899
Draft
KRRT7 wants to merge 2 commits into
Draft
Conversation
Member
|
Hi, could you please decrease the number of active pull requests you have in flight? I would request a maximum of two, personally. We have regular video calls every week you can join if you'd like to talk to the maintainers face-to-face. |
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.
PR summary
Avoid constructing a 0-D boolean mask when
np.copytois called with the exact PythonTrueobject forwhere, matching the existing ufunc fast path. Other mask-like inputs keep the existing conversion path.ASV quick compare for
bench_io.CopyToWhereTrue.time_copyto:7.04 us -> 1.96 us(ratio 0.28).First time committer introduction
I am a NumPy user/contributor looking at small, focused performance improvements in common array operations. I will handle review discussion and follow-up changes directly.
AI Disclosure
LLM / Harness: hybrid.
AI assistance was used to inspect the codebase, run local commands and benchmarks, draft PR text, and help prepare candidate patches. I reviewed the generated suggestions, selected the final changes, and am responsible for the code, submission, and follow-up discussion. Some PR text and candidate code edits were drafted with AI assistance; the final patch and text were reviewed and edited by me.