Skip to content

Conversation

@ZhangYu0123
Copy link
Contributor

@ZhangYu0123 ZhangYu0123 commented Aug 17, 2020

Proposed changes

Optimise bit operation in variable length coding. Remove unnecessary bit operation.
Detail description: #4367

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] Documentation Update (if none of the other choices apply)
  • [] Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have create an issue on (Fix #ISSUE), and have described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] If this change need a document change, I have updated the document
  • [] Any dependent changes have been merged

chaoyli
chaoyli previously approved these changes Aug 17, 2020
@ZhangYu0123 ZhangYu0123 requested a review from imay August 18, 2020 01:51
@sduzh
Copy link
Contributor

sduzh commented Aug 18, 2020

Not intended to interfere, just curious about how many improvements can be achieved from this PR, are there any benchmarks?

@ZhangYu0123
Copy link
Contributor Author

ZhangYu0123 commented Aug 18, 2020

Not intended to interfere, just curious about how many improvements can be achieved from this PR, are there any benchmarks?

In my develop computure, when encode_varint64 execute 1 billion times. v | B version averagely uses 95095ms in 5 times.
(v & (B - 1)) version averagely uses 96103ms in 5 times. It can improve aboat 0.5% ~ 1%. Encode_varint64 is used high frequency in many cases like bitmap_value, page_pointer encode and so on.

@imay
Copy link
Contributor

imay commented Aug 18, 2020

Not intended to interfere, just curious about how many improvements can be achieved from this PR, are there any benchmarks?

In my develop computure, when encode_varint64 execute 1 billion times. v | B version averagely uses 95095ms in 5 times.
(v & (B - 1)) version averagely uses 96103ms in 5 times. It can improve aboat 0.5% ~ 1%. Encode_varint64 is used high frequency in many cases like bitmap_value, page_pointer encode and so on.

It seems too slow to execute 5 bilion enocde operation in about 95s

@ZhangYu0123
Copy link
Contributor Author

Not intended to interfere, just curious about how many improvements can be achieved from this PR, are there any benchmarks?

In my develop computure, when encode_varint64 execute 1 billion times. v | B version averagely uses 95095ms in 5 times.
(v & (B - 1)) version averagely uses 96103ms in 5 times. It can improve aboat 0.5% ~ 1%. Encode_varint64 is used high frequency in many cases like bitmap_value, page_pointer encode and so on.

It seems too slow to execute 5 bilion enocde operation in about 95s

5 billion costs 95s * 5. Compression is time consuming. This encode_varint64 is mainly used to compress low-bit int to variable length instead of int64_t type. It is trade-off between time and space.

@yangzhg
Copy link
Member

yangzhg commented Aug 19, 2020

@imay From the point of view of implementation, our implementation should be copied from leveldb, but leveldb has removed some unnecessary bit operation in this pr google/leveldb@cf1b5f4#diff-0f30ecb01c7888631c52ec595204f7f0 , so I think we can accept this pr and change to the same implementation as level db, although this change improves performance not particularly big

@imay imay added approved Indicates a PR has been approved by one committer. area/util Issues or PRs related to Utilities labels Aug 19, 2020
@morningman morningman merged commit 60d9d31 into apache:master Aug 20, 2020
acelyc111 pushed a commit to acelyc111/incubator-doris that referenced this pull request Aug 21, 2020
Optimize bit operation in variable length coding. Remove unnecessary bit operation.
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/util Issues or PRs related to Utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants