-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
delay error object creation to when errors occur #3946
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
Don't have time to do another detailed review of this but a quick skim seems fine! Do you know if we actually have test coverage for the fp error and extobj stuff? |
added tests for the extobj case. the NULL issue in arinks code can only be triggered by disabling the default extobj setting in numeric.py the warning test is disabled as is the raising test, see #2350 |
Looks like a test needs fixing.
|
#endif | ||
static PyObject *PyUFunc_PYVALS_NAME = NULL; | ||
|
||
static PyObject * _get_global_ext_obj(char * name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static PyObject *
on previous line.
Looks good modulo a few nitpicks, although I can't claim to have read or understood the code in any depth ;) I don't particularly like function names with prefixed |
python convention got the better of me :) |
Failure on python 2.6.
There is also a warning printed during the tests, but I'm not sure that is from this PR. |
its from this pr, I used the warning manager slightly wrong, I pushed an update that should fix it. |
or not... pytohn2.6 seems to behave different :( |
stupid me, assertIn does not exist in 2.6 |
For every single operation calls, numpy has to extract value of buffersize, errormask and name to pack and build error object. These two functions, _extract_pyvals and PyUFunc_GetPyValues together use >12% of time.
_get_global_ext_obj: retrieves global ufunc object _get_bufsize_errmask: get only bufsize and errormask from ufunc object _extract_pyvals: handle NULL extobj PyUFunc_GetPyValues implemented as _get_global_ext_obj +_extract_pyvals drop unused first_error variable. fix errobj memory leak in previous commit. add some test for the extobj and warning path, the warning tests are disabled like the raising path as they fail on a bunch of platforms.
updated, I left the underscore prefix, every static function in that file has it, so it is consistent. |
Something for another day ;) There are other files that make use of it. |
Let's give it a shot. Thanks @juliantaylor and @arinkverma. |
delay error object creation to when errors occur
includes the changes in #3686 with additional refactoring.
improves scalar performance by about 15%