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

[WIP] First small optimisation for z-order curve (a<x and x<b => a<x<b) #7327

Closed
wants to merge 3 commits into from

Conversation

stavrolia
Copy link
Contributor

@stavrolia stavrolia commented Oct 15, 2019

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

For changelog. Remove if this is non-significant change.
First small improvement of KeyCondition.
Category (leave one):

  • Improvement

@stavrolia stavrolia changed the title [WIP] Another branch for z-order curve First small optimisation for z-order curve (a<x and x<b => a<x<b) Oct 23, 2019
@stavrolia stavrolia added the pr-improvement Pull request with some product improvements label Oct 23, 2019
@akuzm akuzm self-requested a review October 23, 2019 11:44
Comment on lines 454 to 455
if (
lhs.function == RPNElement::FUNCTION_IN_RANGE &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove this line break.

@akuzm
Copy link
Contributor

akuzm commented Oct 24, 2019

Can we add some kind of test for this code?

{
const size_t to_modify = rpn.size() - 3;
const auto rhs = rpn[to_modify + 1];
const auto lhs = rpn[to_modify];
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use references here.

Also, let's create a merged element on stack and then put it in rpn if the merge succeeds -- when modifying in place, we can leave some rubbish, especially if some field is added in the future.

lhs.monotonic_functions_chain == rhs.monotonic_functions_chain)
{
bool merged = false;
if (!lhs.range.right_bounded && !rhs.range.left_bounded)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just always use Range::intersectRange, or is there some case when this doesn't work?

@stavrolia stavrolia changed the title First small optimisation for z-order curve (a<x and x<b => a<x<b) [WIP] First small optimisation for z-order curve (a<x and x<b => a<x<b) Nov 27, 2019
@alexey-milovidov
Copy link
Member

Let's continue?

@stavrolia
Copy link
Contributor Author

Yep, I would soon

@stavrolia
Copy link
Contributor Author

I couldn't reproduce improvement from this optimization and stucked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-docs-needed pr-improvement Pull request with some product improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants