Skip to content
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

<algorithm>: find and count could vectorize in more cases #3249

Closed
strega-nil-ms opened this issue Nov 30, 2022 · 3 comments · Fixed by #3267
Closed

<algorithm>: find and count could vectorize in more cases #3249

strega-nil-ms opened this issue Nov 30, 2022 · 3 comments · Fixed by #3267
Assignees
Labels
fixed Something works now, yay! performance Must go faster

Comments

@strega-nil-ms
Copy link
Contributor

strega-nil-ms commented Nov 30, 2022

There are two cases which are currently not covered by _Vector_alg_in_find_is_safe and _Could_compare_equal_to_value_type/_Within_limits:

  • is_pointer_v<_Elem> && is_null_pointer_v<_ValueType>
  • is_pointer_v<_Elem> && is_pointer_v<_ValueType> && is_object_v<remove_pointer_t<_Elem>> && is_void_v<remove_pointer_t<_ValueType>>
@strega-nil-ms strega-nil-ms added the performance Must go faster label Nov 30, 2022
@strega-nil-ms strega-nil-ms self-assigned this Nov 30, 2022
@AlexGuteniev

This comment was marked as resolved.

@StephanTLavavej
Copy link
Member

A couple of observations:

  • This is symmetric, so in addition to searching for void* in a range of U*, the case of searching for U* in a range of void* could equally be optimized.
    • (There's no point in having symmetry for the nullptr_t case, of course 😹)
  • Also, very much like the copy optimizations that we have, cv1 U* is guaranteed bit-identical to cv2 U*, so searching for one in a range of the other could be optimized. (That is, instead of insisting that the pointer types be absolutely identical, we could verify that they point to the same type after removing cv-qualifiers.)

There's definitely a complexity cost to adding additional metaprogramming and test coverage for such scenarios, so we need to draw the line at some point we consider reasonable - just some ideas for potential future work.

@strega-nil-ms

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Something works now, yay! performance Must go faster
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants