Skip to content
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

Draft: ENH: Improve performance of np.broadcast_arrays (v2) #26214

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

eendebakpt
Copy link
Contributor

@eendebakpt eendebakpt commented Apr 4, 2024

This PR uses np.nditer to implement np.broadcast_arrays. The performance is good (also see #26160):

main:
broadcast_arrays(*args) 1.20 us
broadcast_arrays(*args_two) 7.26 us
broadcast_arrays(*args_multi) 9.11 us

PR #26160
broadcast_arrays(*args) 1.03 us
broadcast_arrays(*args_two) 3.83 us
broadcast_arrays(*args_multi) 3.87 us

PR:
broadcast_arrays(*args) 0.89 us
broadcast_arrays(*args_two) 0.99 us
broadcast_arrays(*args_multi) 1.15 us

A change in behaviour is that all output of np.broadcast_arrays is now readonly. This might be acceptable, as writeable broadcasted arrays have been deprecated for some time: #12609

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant