-
-
Notifications
You must be signed in to change notification settings - Fork 11k
MAINT: cleanup of fast_loop_macros.h #13208
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -652,7 +652,11 @@ BOOL__ones_like(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UN | |
NPY_NO_EXPORT void | ||
BOOL_@kind@(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func)) | ||
{ | ||
OUTPUT_LOOP_FAST(npy_bool, *out = @val@); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious - is it any slower is we just use If it is, I'd be inclined to maintain fewer macros. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dug up the benchmark I wrote and quickly tried out your suggestion. I'll need to check my code in the morning but it looks like it causes a substantial regression:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good news - there was a typo in what I tested last night and there's no performance impact if we just use |
||
/* | ||
* The (void)in; suppresses an unused variable warning raised by gcc and allows | ||
* us to re-use this macro even though we do not depend on in | ||
*/ | ||
UNARY_LOOP_FAST(npy_bool, npy_bool, (void)in; *out = @val@); | ||
} | ||
|
||
/**end repeat**/ | ||
|
@@ -896,7 +900,11 @@ NPY_NO_EXPORT void | |
NPY_NO_EXPORT void | ||
@TYPE@_@kind@(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func)) | ||
{ | ||
OUTPUT_LOOP_FAST(npy_bool, *out = @val@); | ||
/* | ||
* The (void)in; suppresses an unused variable warning raised by gcc and allows | ||
* us to re-use this macro even though we do not depend on in | ||
*/ | ||
UNARY_LOOP_FAST(@type@, npy_bool, (void)in; *out = @val@); | ||
} | ||
/**end repeat1**/ | ||
|
||
|
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.
I was suggesting replacing
op;
by*out = val
so that the call passes@val@
instead of the assignment statement.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.
Right, but that was in output_loop which is now gone completely