Skip to content

PERF: skip copyto mask conversion for where=True#31899

Draft
KRRT7 wants to merge 2 commits into
numpy:mainfrom
KRRT7:copyto-where-true-fastpath
Draft

PERF: skip copyto mask conversion for where=True#31899
KRRT7 wants to merge 2 commits into
numpy:mainfrom
KRRT7:copyto-where-true-fastpath

Conversation

@KRRT7

@KRRT7 KRRT7 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

PR summary

Avoid constructing a 0-D boolean mask when np.copyto is called with the exact Python True object for where, 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.

@ngoldbaum

Copy link
Copy Markdown
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.

@KRRT7 KRRT7 marked this pull request as draft July 7, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants