Skip to content

reduce bytes used when serializing Extent #52549

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

Merged
merged 5 commits into from
Feb 24, 2020

Conversation

talevy
Copy link
Contributor

@talevy talevy commented Feb 20, 2020

This commit reflects comments made by Adrien in #50834 surrounding the Extent serialization.

it re-orders and negates a few values in order to save more space

@talevy talevy added the :Analytics/Geo Indexing, search aggregations of geo points and shapes label Feb 20, 2020
@talevy talevy requested review from jpountz and iverase February 20, 2020 01:45
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Geo)

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

I left a suggestion, otherwise LGTM.

negLeft = Math.toIntExact(posRight - input.readVLong());
posLeft = 0;
negRight = 0;
break;
default:
case ALL_SET:
posRight = input.readVInt();
posLeft = Math.toIntExact(posRight - input.readVLong());
negRight = input.readInt();
negLeft = Math.toIntExact(negRight - input.readVLong());
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably update ALL_SET to have the same logic as POSITIVE_SET and NEGATIVE_SET combined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to what I think you meant

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I was thinking of doing this:

                posLeft = input.readVInt();
                posRight =  Math.toIntExact(input.readVLong() + posLeft);
                negRight = -input.readVInt();
                negLeft = Math.toIntExact(negRight - input.readVLong());

There is no reason to serialize posLeft/posRight differently in the POSITIVE_SET case or in the ALL_SET case? And likewise for negLeft/negRight in the NEGATIVE_SET or ALL_SET cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad. I misunderstood. will update thanks

@talevy
Copy link
Contributor Author

talevy commented Feb 20, 2020

@jpountz thanks for the suggestions.

I did a rough speed/size test of these changes and found the following
performance numbers on 3 million random Extents. recorded time spent
writing/reading an Extent and its size.

before changes:

writeSpeed: 172.679105 ns
readSpeed: 53.29868 ns
byte-size: 19.23683 bytes

after changes:

writeSpeed: 169.303268 ns
readSpeed: 52.649607 ns
byte-size: 19.163605 bytes

@talevy
Copy link
Contributor Author

talevy commented Feb 20, 2020

@elasticmachine run elasticsearch-ci/1

@talevy talevy merged commit 54483c9 into elastic:geoshape-doc-values Feb 24, 2020
@talevy talevy deleted the gdv-adrien1 branch February 24, 2020 17:31
talevy added a commit that referenced this pull request Feb 24, 2020
This commit reflects comments made by Adrien in #50834
surrounding the Extent serialization.

it re-orders and negates a few values in order to save more space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants