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

Update cartesian product to provide better perf for parallel execution #4

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AnastasiaStulova
Copy link

@AnastasiaStulova AnastasiaStulova commented May 15, 2023

This PR changes the way iterators are advanced to achieve up to 3x speedup when using cartesian product with par execution policy in for_each.

The main idea is to keep one index that is being advanced (as a canonical induction variable) and the iterators are being computed using mod/div operation from the induction variable.

Note: this approach doesn't work well when executing with seq policy particularly when there are more than 2 iterators in cartesian product.

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.

1 participant