-
Notifications
You must be signed in to change notification settings - Fork 849
chore(query): Optimize hot path allocations in query formatting and metadata operations #19163
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
Conversation
|
At least one test kind must be checked in the PR description. |
|
Pull request description must contain CLA like the following: |
|
At least one type of change must be checked in the PR description. |
- Replace += &format!() with write!() macro in format.rs to avoid unnecessary allocations - Replace += with push_str() for string literals in parser/error.rs - Add Vec::with_capacity in kv_pb_api for pre-allocated vectors - Optimize u64 formatting in key_builder.rs to write directly to buffer Co-authored-by: sundy-li <[email protected]>
Move std::io::Write import inside the function to avoid trait conflicts Co-authored-by: sundy-li <[email protected]>
Improve code organization by placing imports at the module level Co-authored-by: sundy-li <[email protected]>
|
This pull request's title is not fulfill the requirements. @Copilot please update it 🙏. Valid format: Valid types:
|
1 similar comment
|
This pull request's title is not fulfill the requirements. @Copilot please update it 🙏. Valid format: Valid types:
|
Identified and eliminated unnecessary allocations in frequently-executed code paths through targeted refactoring of string operations and collection initialization.
Changes
Query result formatting (
executor/format.rs): Replaced+= &format!()with directwrite!()calls to avoid intermediate String allocations in pruning statistics generationMetadata key operations (
kv_pb_api/mod.rs): Pre-allocate result vectors with known capacity instead of growing incrementally during chunked key processingKey construction (
key_builder.rs): Write numeric values directly to byte buffer viastd::io::Writeinstead of allocating temporary stringsParser errors (
parser/error.rs): Usewrite!()andpush_str()instead of+= &format!()patternBefore:
After:
These paths are executed per-query and per-metadata operation, making allocation reduction meaningful at scale.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https /usr/lib/apt/methods/https --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --check-cfg cfg(docsrs,test) --check-cfg cfg(feature, values()) n-li�� n-linux-gnu/lib/debuginfo=2 7792/build_script_build-6014bd6bab5c7792 n-linux-gnu/lib/rustlib/x86_64-REDACTED-linux-gnu/bin/rust-lld n-linux-gnu/lib//home/REDACTED/.rustup/toolchains/nightly-2025-12-11-x86_64-REDACTED-linux-gnu/bin/rustc n-linux-gnu/lib/--crate-name n-linux-gnu/lib/display_more n-linux-gnu/lib/--edition=2021(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
This change is