Skip to content

perf: use hex.EncodeToString instead of fmt.Sprintf("%x", ...)#3132

Merged
matiasinsaurralde merged 1 commit into
mainfrom
perf/hex-encoding
May 19, 2026
Merged

perf: use hex.EncodeToString instead of fmt.Sprintf("%x", ...)#3132
matiasinsaurralde merged 1 commit into
mainfrom
perf/hex-encoding

Conversation

@matiasinsaurralde

Copy link
Copy Markdown
Contributor

Summary

Replace fmt.Sprintf("%x", ...) hex-encoding calls with hex.EncodeToString across the CAS, CLI, control plane signing, and attestation verifier code paths.

hex.EncodeToString avoids the fmt reflection machinery and is roughly 5x faster, which matters on hot paths such as per-chunk checksum stringification in the CAS bytestream service and per-certificate key-ID derivation in signing and verification.

Replace fmt.Sprintf("%x", ...) hex-encoding calls with
hex.EncodeToString, which avoids fmt reflection and is
faster on hot paths (digest checksums, signing key IDs).

Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
@matiasinsaurralde matiasinsaurralde requested a review from a team May 19, 2026 06:45

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 8 files

Re-trigger cubic

@matiasinsaurralde matiasinsaurralde merged commit ee6f4c9 into main May 19, 2026
15 checks passed
@matiasinsaurralde matiasinsaurralde deleted the perf/hex-encoding branch May 19, 2026 17:32
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.

2 participants