8000 Scalar binop giveup in fallback by ganesh-k13 · Pull Request #1 · ganesh-k13/numpy · GitHub
[go: up one dir, main page]

Skip to content

Scalar binop giveup in fallback #1

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

Closed
wants to merge 7 commits into from

Conversation

ganesh-k13
Copy link
Owner

No description provided.

seberg and others added 7 commits August 4, 2020 13:01
This function is used to be called `_typenum_fromtypeobj` but
since it is used in more places (including one new added now),
giving it a long descriptive name seemed reasonable.

Ideally, I would like to phase out the `user` option and expose
(or use) the new functionality in the array-coercion to handle
such cases making this only useful for super-fast paths of
our internal scalars.
This simplification and code change does a few things:

1. We remove all binop deferals, by simply only handling the numeric
   numpy scalars and python floats+integers specifically.
   All other object will cause deferal.
   This specifically defers subclassess even of NumPy scalars
   (unless it is `class+subclass` where Python will reverse the
   lookup.
2. We always defer binops if the type number of the current type
   is smaller.  This allows `float32 + float64` to retry with
   `float64 + float32`, which is much faster.
3. It simplifies the double special cases and expand it to
   include longdouble.

The previous casting code was faster, so cases such as:

    float64 + float32

were somewhat faster.  However, previously `float32 + float64`
would end up using the fallback path and thus be *much* slower.

Identically, `scalar + array0d` had previously a fast-path which
is now removed.  While, thus much slower, it means that the
performance is now symmetric wtih `array0d + scalar`.

Generally, it could make sense to make a dumbed down ufunc machinery
for 0D scalars, to strike a middle path between the current super-slow
array fallback and the somewhat quick scalar paths.

However, scalars do have the advantage that they can refuse to handle
anything that is not known much easier, i.e. they do not need to find
the common dtype. If the other scalar is not known, they can just defer
(or rather fall back to the slow paths).
@ganesh-k13 ganesh-k13 force-pushed the scalar-binop-giveup-in-fallback branch from 3e1fc91 to 3e3a4dd Compare December 8, 2020 16:05
ganesh-k13 pushed a commit that referenced this pull request Feb 10, 2021
…py#18295)

* BUG: don't mutate list of fake libraries while iterating over it

* BUG: iterate over copy of list

* TST: add build test for build_ext fix (#1)

* TST: add build test for build_ext fix

* TST: clearer test name

* STY: use triple quotes instead of lists of strings

* FIX: check for f77 compiler before test is run

* DOC: add comment explaining that a list copy is necessary
@ganesh-k13 ganesh-k13 closed this Apr 14, 2021
seiko2plus pushed a commit that referenced this pull request May 19, 2021
update from main - fixing SVD
ganesh-k13 pushed a commit that referenced this pull request Aug 14, 2021
ganesh-k13 pushed a commit that referenced this pull request Apr 10, 2024
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.

2 participants
0