Skip to content

Optimize toSearchParams #449

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 2 commits into from
Aug 14, 2025
Merged

Conversation

twk
Copy link
Contributor

@twk twk commented Aug 5, 2025

Summary

I noticed toSearchParams showing up in profiles. I wrote a benchmarking script that revealed it had super-linear run times as the number of params grew:

--- Benchmarking with 10 params ---
Original: 0.08ms per iteration
Optimized: 0.09ms per iteration

--- Benchmarking with 100 params ---
Original: 0.37ms per iteration
Optimized: 0.06ms per iteration

--- Benchmarking with 1000 params ---
Original: 6.62ms per iteration
Optimized: 0.72ms per iteration

--- Benchmarking with 10000 params ---
Original: 602.41ms per iteration
Optimized: 13.18ms per iteration

--- Benchmarking with 100000 params ---
Original: 50449.80ms per iteration
Optimized: 224.65ms per iteration

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@CLAassistant
Copy link

CLAassistant commented Aug 5, 2025

CLA assistant check
All committers have signed the CLA.

@mshustov mshustov requested a review from slvrtrn August 12, 2025 16:59
Copy link
Contributor

@slvrtrn slvrtrn left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

Failed Cloud tests are due to the lack of access to the required secrets.

@slvrtrn slvrtrn merged commit 5d82442 into ClickHouse:main Aug 14, 2025
22 of 26 checks passed
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.

3 participants