Skip to content

Speed up Decimal comparison - #90153

Merged
thevar1able merged 5 commits into
masterfrom
try-speedup-decimal-comparison
Nov 19, 2025
Merged

thevar1able merged 5 commits into
masterfrom
try-speedup-decimal-comparison

Conversation

@thevar1able

@thevar1able thevar1able commented Nov 16, 2025 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Improved performance of Decimal comparison operations. Resolves #28192.

https://pastila.nl/?0202858e/0ff4fbde7e3d8d0d80b158a82ce6d93f#G4y8HbLIRvg3Y23lCHpYMQ==

@clickhouse-gh

clickhouse-gh Bot commented Nov 16, 2025 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0a15a51]

Summary: ❌

job_name test_name status info comment
Integration tests (amd_binary, 2/5) failure
test_dotnet_client/test.py::test_dotnet_client FAIL cidb
BuzzHouse (amd_debug) failure
Logical error: 'Inconsistent AST formatting: the query: FAIL cidb
Performance Comparison (arm_release, master_head, 4/6) failure
Check Results failure

@clickhouse-gh clickhouse-gh Bot added the pr-performance Pull request with some performance improvements label Nov 16, 2025
Comment thread src/Columns/ColumnDecimal.cpp Resolved
@nihalzp nihalzp self-assigned this Nov 17, 2025
@thevar1able
thevar1able marked this pull request as ready for review November 17, 2025 16:00
@thevar1able thevar1able changed the title Try speeding up Decimal comparison Speed up Decimal comparison Nov 17, 2025
@thevar1able

Copy link
Copy Markdown
Member Author

@thevar1able

Copy link
Copy Markdown
Member Author

x86_64
image

aarch64
image

There are also 10-20% improvements across tests that touch Decimals.

Comment thread src/Columns/ColumnDecimal.cpp Resolved
Comment thread src/Columns/ColumnDecimal.cpp Outdated
Comment on lines +475 to +476
res_data.reserve_exact(offsets.back());
res_data.resize(offsets.back());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can combine both of them via single method call resize_exact.

    template <typename ... TAllocatorParams>
    void resize_exact(size_t n, TAllocatorParams &&... allocator_params) /// NOLINT
    {
        reserve_exact(n, std::forward<TAllocatorParams>(allocator_params)...);
        resize_assume_reserved(n);
    }

@thevar1able

thevar1able commented Nov 19, 2025 •

Copy link
Copy Markdown
Member Author

I have a feeling resize_exact() causes up to 30% regression in rand tests for aarch64; the regression is not there for commits before 0a15a51.

I'm going to validate on aarch64 host and revert if confirmed.

@thevar1able

Copy link
Copy Markdown
Member Author

@thevar1able
thevar1able added this pull request to the merge queue Nov 19, 2025
Merged via the queue into master with commit 500f59a Nov 19, 2025
@thevar1able
thevar1able deleted the try-speedup-decimal-comparison branch November 19, 2025 18:51
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-performance Pull request with some performance improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DateTime64 (Decimal64) comparsion much slower than UInt64 or DateTime

4 participants