Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[libc++] Speed up set_intersection() by fast-forwarding over ranges of non-matching elements with one-sided binary search. #75230
[libc++] Speed up set_intersection() by fast-forwarding over ranges of non-matching elements with one-sided binary search. #75230
Changes from 49 commits
b65415f
f6bcf27
36bb63e
c23272c
0b57ea0
08af548
7aa3927
c44c2a2
46cc95f
450f5ce
d0c5f2b
faa3115
995d04b
d568d49
6ba7061
76c33ca
bb872e0
a1cd8ff
24d1d5b
f17fa58
4b73773
65bd9b7
d0facc5
a12aa37
69dba78
fe1fe8c
bb2c758
c6b895c
31321b9
6c88549
3805e95
090df86
cb92d3c
f4a6f36
3f9cfec
1afb99d
613e64a
4588447
2af9a6f
4f05ded
161d81c
3c9f800
4aa4a82
8307b2d
be6c5c8
62a6010
e2af5cc
89201ea
5f6e7fe
109e5a4
cc95b51
91e4e51
c977bb7
b4fad5b
87f12c2
505c004
95b118a
b1bfa0f
f501bdc
c5df570
6189e95
6eacf2f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Let's move this code after "old" line 159 (the existing definition of
__advance_to
).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 think it might be possible to do something like (pseudo):
@philnik777 Do you have thoughts on this? I wonder if we should consider that it's OK (under the as-if rule) to change the complexity of an algorithm with respect to a certain operation if that change cannot be observed other than by e.g. timing the algorithm. At first glance, I would say this is a very pedantic and not especially useful way of constraining ourselves, but I'm curious to hear what you think about this.
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.
We can certainly improve the complexity here (http://eel.is/c++draft/structure#specifications-7). I do wonder whether this is also the case for the "exactly N times" specifications, but I don't think it's in the interest of anybody to force implementations to add overhead for conformance. Making the complexity worse (by more than a constant factor) would be another story. We already break the complexity requirements by a constant factor if it's not observable, e.g. in
ranges::minmax
with integers.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.
That's also my thinking.
@ichaer After this patch has landed, you could consider a patch like the above if you want -- I think we'd take it.
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.
Awesome =D, thanks!