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

[TableGen] Use vectors instead of sets for testing intersection. NFC. #81602

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

jayfoad
Copy link
Contributor

@jayfoad jayfoad commented Feb 13, 2024

In a few places we test whether sets (i.e. sorted ranges) intersect by
computing the set_intersection and then testing whether it is empty. For
this purpose it should be more efficient to use a std:vector instead of
a std::set to hold the result of the set_intersection, since insertion
is simpler.

In a few places we test whether sets (i.e. sorted ranges) intersect by
computing the set_intersection and then testing whether it is empty. For
this purpose it should be more efficient to use a std:vector instead of
a std::set to hold the result of the set_intersection, since insertion
is simpler.
Copy link
Contributor

@Pierre-vh Pierre-vh left a comment

Choose a reason for hiding this comment

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

If I understand correctly this doesn't change the logic of how the intersection is done, just the data structure used to hold the result of the intersection ? If so then LGTM

Copy link
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

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

LGTM as well

@jayfoad
Copy link
Contributor Author

jayfoad commented Feb 13, 2024

If I understand correctly this doesn't change the logic of how the intersection is done, just the data structure used to hold the result of the intersection ? If so then LGTM

Exactly. I could not find a simple more efficient way to do the intersection test itself.

@jayfoad jayfoad merged commit 880afa1 into llvm:main Feb 13, 2024
4 of 5 checks passed
@jayfoad jayfoad deleted the tablegen-set-intersection branch February 13, 2024 13:44
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.

None yet

3 participants