Skip to content

Conversation

@charris
Copy link
Member

@charris charris commented Dec 3, 2020

Backport of #17896.

This is a small followup of gh-15852. I realize these are micro-optimizations, but... Half the point of this file is probably a micro-optimization for any/all by unpacking the kwargs, and this does give a 20-30% boost for very small arrays. We should probably add some "tiny array" benchmarks.

Anyway, on the grand scheme of things, this may not matter, but they are also super simple changes.

Fixes gh-17894

This removes a 20%-30% overhead, and thus the largest chunk of
slowdown incurred by adding the `where` argument. Most other places
have fast-paths for `where=True`, this one also should have it.

The additional argument does slow down the function versions a bit
more than this, but that is to be expected probably (it has to
build a new argument dict, at some point we might want to move this
to C, but that seems worth much more with FASTCALL logic).
@charris charris added 01 - Enhancement 08 - Backport Used to tag backport PRs labels Dec 3, 2020
@charris charris added this to the 1.20.0 release milestone Dec 3, 2020
@charris charris merged commit fb3db8c into numpy:maintenance/1.20.x Dec 3, 2020
@charris charris deleted the backport-17896 branch December 3, 2020 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

01 - Enhancement 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants