Skip to content

Improve implementations of __set_difference_construct() and __set_symmetric_difference_construct()#2612

Draft
SergeyKopienko wants to merge 20 commits intomainfrom
dev/skopienko/branchless_set_op_construct
Draft

Improve implementations of __set_difference_construct() and __set_symmetric_difference_construct()#2612
SergeyKopienko wants to merge 20 commits intomainfrom
dev/skopienko/branchless_set_op_construct

Conversation

@SergeyKopienko
Copy link
Contributor

@SergeyKopienko SergeyKopienko commented Mar 12, 2026

Refactors the set-operation construction helpers in the PSTL parallel backend utilities to streamline control flow and ensure remaining ranges are copied after the main comparison loop.

Changes:

  • Refactored __set_difference_construct() to use a while loop over both ranges and copy any remaining [first1,last1) tail afterward.
  • Refactored __set_symmetric_difference_construct() to use a while loop over both ranges and then copy the remaining tail from whichever range is not exhausted.

These changes gave us some performance profit.

…n_construct() without if...else statement inside loop
…rsection_construct() without if...else statement inside loop
…erence_construct() without if...else statement inside loop
…etric_difference_construct() without if...else statement inside loop
This reverts commit d203545.
…set_symmetric_difference_construct() without if...else statement inside loop"

This reverts commit 5336d78.
…set_difference_construct() without if...else statement inside loop"

This reverts commit 9b9feb3.
…set_intersection_construct() without if...else statement inside loop"

This reverts commit 943d6c1.
…set_union_construct() without if...else statement inside loop"

This reverts commit df9aaa7.
…rformance of __set_union_construct()"

This reverts commit 3b74f64.
@SergeyKopienko SergeyKopienko requested a review from Copilot March 12, 2026 14:04
@SergeyKopienko SergeyKopienko changed the title Improve implementations of __set_union_construct(), __set_intersection_construct(), __set_difference_construct() and __set_symmetric_difference_construct() Improve implementations of __set_difference_construct() and __set_symmetric_difference_construct() Mar 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the set-operation construction helpers in the PSTL parallel backend utilities to streamline control flow and ensure remaining ranges are copied after the main comparison loop.

Changes:

  • Refactored __set_difference_construct() to use a while loop over both ranges and copy any remaining [first1,last1) tail afterward.
  • Refactored __set_symmetric_difference_construct() to use a while loop over both ranges and then copy the remaining tail from whichever range is not exhausted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

SergeyKopienko and others added 2 commits March 12, 2026 15:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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