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

Precalculate values inside HashTableGrower #38413

Conversation

nickitat
Copy link
Member

@nickitat nickitat commented Jun 24, 2022

Changelog category (leave one):

  • Performance Improvement

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

Optimized insertion and lookups in the HashTable.

@robot-clickhouse robot-clickhouse added the pr-performance Pull request with some performance improvements label Jun 24, 2022
@nickitat
Copy link
Member Author

nickitat commented Jun 26, 2022

perf tests: 1 3 4

perf tests with alignment: 1 3 4

there are few slowdowns caused apparently by increasing grower size:

0.271 0.338 +1.246x 0.246 0.246 functions_with_hash_tables 4 select groupUniqArray(rand() % 100) from numbers(1000 * 1000) group by number / 1000 format Null
1.194 1.383 +1.157x 0.157 0.157 uniq 11 SELECT ClientIP AS k, uniqExact(UserID) FROM hits_100m_single GROUP BY k FORMAT Null

both use HT with stack memory with initial_size_degree = 4. In theory we could provide another HashTableGrower implementation for them, but IMO it doesn't really makes sense 'cause queries are fairly artificial.

@nickitat nickitat marked this pull request as ready for review June 26, 2022 21:25
@nickitat nickitat changed the title Cache values inside hash table grower Precalculate values inside HashTableGrower Jun 26, 2022
@alexey-milovidov alexey-milovidov self-assigned this Jun 27, 2022
@nickitat
Copy link
Member Author

new perf tests: 1 3

@nickitat
Copy link
Member Author

nickitat commented Jun 30, 2022

new perf tests: 1 2 + a couple of queries with dictionaries also became slightly faster.

slowdown in single_fixed_string_groupby #0 doesn't reproduce. slowdowns in other queries don't reproduce either and moreover they shouldn't use hash tables at all.

@alexey-milovidov
Copy link
Member

Let's check what's wrong with WITH FILL test.
It is definitely unrelated... but we can postpone merging this PR one or two days just to eliminate another flaky test more quickly.

Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

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

LGTM

@nickitat
Copy link
Member Author

nickitat commented Jul 1, 2022

Let's check what's wrong with WITH FILL test.

I'm trying to fix it here #38705

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants