-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
TST: add temporary elision testcases #4856
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
Conversation
see #4322 for a branch where the tests would fail on. |
Not sure what this is about, could you explain a bit more? |
A very significant optimization for numpy would be to avoid the temporaries in these types of expressions: res = a + b + c transforming it into: res = a + b res += c An approach to do that is to check the reference count of the PyNumber slot arguments, temporary expressions coming from python have reference count 1 and can be converted to inplace operations. Unfortunately C-extensions can skip increasing reference counts for operations breaking the assumption that an inplace operation can be performed, e.g. Cython does this type of optimizations. To ensure to not accidentally break such extensions in future test that refcount == 1 operands from extensions are not elided.
updated the commit message |
OK, makes sense. Is test failure the best way to check this? |
how else would you test it? |
I was wondering if you wanted to collect statistics or check if numpy would
|
the use is the same as any other test, make sure that something that works now keeps working in the future. |
TST: add temporary elision testcases
OK, thanks. |
A very significant optimization for numpy would be to avoid the
temporaries in these types of expressions:
transforming it into:
An approach to do that is to check the reference count of the PyNumber
slot arguments, temporary expressions coming from python have reference
count 1 and can be converted to inplace operations.
Unfortunately C-extensions can skip increasing reference counts for
operations breaking the assumption that an inplace operation can be
performed, e.g. Cython does this type of optimizations.
To ensure to not accidentally break such extensions in future test
that refcount == 1 operands from extensions are not elided.