Skip to content

[Improvement] add zlib_crc32_fixed#60735

Open
BiteTheDDDDt wants to merge 3 commits intoapache:masterfrom
BiteTheDDDDt:opt_0213
Open

[Improvement] add zlib_crc32_fixed#60735
BiteTheDDDDt wants to merge 3 commits intoapache:masterfrom
BiteTheDDDDt:opt_0213

Conversation

@BiteTheDDDDt
Copy link
Contributor

What problem does this PR solve?

zlib_crc32: SplitBlockHashComputeTime: 269.15ms
crc32c_fixed: SplitBlockHashComputeTime: 33.258ms
zlib_crc32_fixed: SplitBlockHashComputeTime: 61.941ms

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

Copilot AI review requested due to automatic review settings February 13, 2026 04:49
@Thearas
Copy link
Contributor

Thearas commented Feb 13, 2026

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@BiteTheDDDDt
Copy link
Contributor Author

run buildall

@BiteTheDDDDt
Copy link
Contributor Author

run buildall

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an optimized zlib_crc32_fixed function to improve CRC32 hash computation performance for fixed-size types. The implementation uses the Slicing-by-4 algorithm, which processes 4 bytes at a time using precomputed lookup tables, achieving a significant performance improvement from 269ms to 62ms for hash computation.

Changes:

  • Adds zlib_crc32_fixed template function using Slicing-by-4 algorithm for 1, 2, 4, and 8-byte types, with fallback to zlib for larger types
  • Implements constexpr CRC32SliceBy4Table for compile-time lookup table generation
  • Refactors column hashing in ColumnVector and ColumnDecimal to use the optimized function
  • Provides comprehensive test coverage for the new function across various data types and edge cases

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
be/src/util/hash_util.hpp Adds CRC32SliceBy4Table struct and zlib_crc32_fixed template function with Slicing-by-4 optimization; updates zlib_crc_hash_null to use the new function
be/src/vec/columns/column_vector.h Declares _zlib_crc32_hash helper method
be/src/vec/columns/column_vector.cpp Refactors update_crcs_with_value to use new _zlib_crc32_hash helper method; implements _zlib_crc32_hash with special handling for date/datetime types
be/src/vec/columns/column_decimal.cpp Replaces direct zlib_crc_hash calls with zlib_crc32_fixed for non-DECIMALV2 types
be/test/util/crc32c_test.cpp Adds comprehensive tests for zlib_crc32_fixed covering all data types, incremental hashing, and edge cases; includes commented-out tests for future crc32c_fixed improvements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@BiteTheDDDDt
Copy link
Contributor Author

run buildall

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.

2 participants