You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Rich-T-kid (via GitHub)" <gi...@apache.org> on 2026/08/03 03:20:09 UTC
[PR] Perf: remove extra allocations for hex operations [datafusion]
Rich-T-kid opened a new pull request, #24057:
URL: https://github.com/apache/datafusion/pull/24057
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
- Closes #23810.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: remove extra allocations for hex operations [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #24057:
URL: https://github.com/apache/datafusion/pull/24057#discussion_r3771997671
##########
datafusion/functions/src/encoding/inner.rs:
##########
@@ -373,7 +373,11 @@ impl Encoding {
match self {
Self::Base64 => BASE64_ENGINE.encode(value),
Self::Base64Padded => BASE64_ENGINE_PADDED.encode(value),
- Self::Hex => encode_hex(value, HexCase::Lower),
+ Self::Hex => {
+ let mut out = Vec::with_capacity(value.len() * 2);
+ encode_bytes_into(value, HexCase::Lower, &mut out);
+ unsafe { String::from_utf8_unchecked(out) }
Review Comment:
e.g. here we can still keep `encode_bytes`
##########
datafusion/common/src/utils/hex.rs:
##########
@@ -161,6 +161,9 @@ pub fn encode_bytes_to_slice(bytes: &[u8], case: HexCase, out: &mut [u8]) -> Res
/// Returns the hex encoding of `bytes` as an owned `String`.
///
+/// Prefer [`encode_bytes_into`] when you already have a reusable output buffer.
+#[deprecated(note = "use encode_bytes_into or encode_bytes_to_slice instead")]
Review Comment:
i do wonder if we should be deprecating this, as it seems theres still some places that would benefit from it, e.g. scalar path of md5
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: remove extra allocations for hex operations [datafusion]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24057:
URL: https://github.com/apache/datafusion/pull/24057#issuecomment-5163085012
## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/24057?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 80.88%. Comparing base ([`21ad189`](https://app.codecov.io/gh/apache/datafusion/commit/21ad1897826a2dd00f31dd8bb574735ca70143d9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`cd5492e`](https://app.codecov.io/gh/apache/datafusion/commit/cd5492e46579f8ecc1548e1105110f9d0bff20a9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #24057 +/- ##
==========================================
- Coverage 80.88% 80.88% -0.01%
==========================================
Files 1101 1101
Lines 375720 375787 +67
Branches 375720 375787 +67
==========================================
+ Hits 303895 303947 +52
- Misses 53729 53738 +9
- Partials 18096 18102 +6
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/24057?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: remove extra allocations for hex operations [datafusion]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #24057:
URL: https://github.com/apache/datafusion/pull/24057#issuecomment-5232680291
@andygrove just wanted to bump
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: remove extra allocations for hex operations [datafusion]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24057:
URL: https://github.com/apache/datafusion/pull/24057#issuecomment-5162681028
<!-- semver-check-comment -->
Thank you for opening this pull request!
Reviewer note: [cargo-semver-checks](https://github.com/obi1kenobi/cargo-semver-checks) reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).
<details>
<summary>Details</summary>
```
Cloning apache/main
Building datafusion-common v54.1.0 (current)
Built [ 35.335s] (current)
Parsing datafusion-common v54.1.0 (current)
Parsed [ 0.060s] (current)
Building datafusion-common v54.1.0 (baseline)
Built [ 35.181s] (baseline)
Parsing datafusion-common v54.1.0 (baseline)
Parsed [ 0.063s] (baseline)
Checking datafusion-common v54.1.0 -> v54.1.0 (no change; assume patch)
Checked [ 0.666s] 223 checks: 222 pass, 1 fail, 0 warn, 30 skip
--- failure function_marked_deprecated: function #[deprecated] added ---
Description:
A function is now #[deprecated]. Downstream crates will get a compiler warning when using this function.
ref: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.49.0/src/lints/function_marked_deprecated.ron
Failed in:
function datafusion_common::utils::hex::encode_bytes in /home/runner/work/datafusion/datafusion/datafusion/common/src/utils/hex.rs:176
Summary semver requires new minor version: 0 major and 1 minor checks failed
Finished [ 73.038s] datafusion-common
Building datafusion-functions v54.1.0 (current)
Built [ 32.158s] (current)
Parsing datafusion-functions v54.1.0 (current)
Parsed [ 0.086s] (current)
Building datafusion-functions v54.1.0 (baseline)
Built [ 32.370s] (baseline)
Parsing datafusion-functions v54.1.0 (baseline)
Parsed [ 0.087s] (baseline)
Checking datafusion-functions v54.1.0 -> v54.1.0 (no change; assume patch)
Checked [ 0.375s] 223 checks: 223 pass, 30 skip
Summary no semver update required
Finished [ 66.474s] datafusion-functions
Building datafusion-spark v54.1.0 (current)
Built [ 61.233s] (current)
Parsing datafusion-spark v54.1.0 (current)
Parsed [ 0.062s] (current)
Building datafusion-spark v54.1.0 (baseline)
Built [ 61.821s] (baseline)
Parsing datafusion-spark v54.1.0 (baseline)
Parsed [ 0.065s] (baseline)
Checking datafusion-spark v54.1.0 -> v54.1.0 (no change; assume patch)
Checked [ 0.368s] 223 checks: 223 pass, 30 skip
Summary no semver update required
Finished [ 125.187s] datafusion-spark
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: remove extra allocations for hex operations [datafusion]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #24057:
URL: https://github.com/apache/datafusion/pull/24057#issuecomment-5162675527
@andygrove this is ready for review 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: remove extra allocations for hex operations [datafusion]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #24057:
URL: https://github.com/apache/datafusion/pull/24057#issuecomment-5162784277
<img width="1868" height="1404" alt="Image 8-3-26 at 1 49 AM" src="https://github.com/user-attachments/assets/283593c7-99f3-4458-bc78-f26cac389a40" />
local benchmarks show promising results
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: remove extra allocations for hex operations [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #24057:
URL: https://github.com/apache/datafusion/pull/24057
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org