Skip to content

registry/storage: avoid duplicate SHA-256 in canonical full-fallback validation - #4921

Merged
milosgajdos merged 1 commit into
distribution:mainfrom
perfloop-oss:perfloop-pr-open-kw28ppj29x
Oct 14, 2026
Merged

milosgajdos merged 1 commit into
distribution:mainfrom
perfloop-oss:perfloop-pr-open-kw28ppj29x

Conversation

@perfloop-agent

Copy link
Copy Markdown
Contributor

Summary

Avoid a redundant canonical SHA-256 pass when blob validation reaches canonical full-hash fallback. The fallback now re-derives the canonical digest from the bytes freshly read from storage and compares it with the requested canonical descriptor. The tested SHA-512/noncanonical fallback scenarios retain their existing verification behavior.

Performance

For the primary 128 MiB in-memory canonical SHA-256 full-fallback validation benchmark, median time improved from 778,789,861.5 ns/op to 416,956,704 ns/op (46.46% lower; p=0.0000108).

Additional Commit full-fallback measurements observed the following medians:

  • 8 MiB: 51,843,064 to 29,074,548 ns/op (43.92% lower; p=0.0000108)
  • 64 MiB: 389,925,988.5 to 213,444,111 ns/op (45.26% lower; p=0.0000108)
  • 256 MiB: 1,575,609,110 to 841,048,106 ns/op (46.62% lower; p=0.0000108)

The SHA-512 fallback measurement was 659,583,574 to 665,301,413.5 ns/op (+0.87%; p=0.247), and resumed SHA-512 was 667,379,567 to 660,202,668 ns/op (-1.08%; p=0.123). Neither difference was statistically significant.

Validation

Focused fallback and resumed-digest tests, go vet for registry/storage, upstream lint, vendor validation, and the binaries/API-document validation passed.

Scope

This change is limited to the full-hash fallback validation branch. The common size-based fast-path branch is not modified and was not benchmarked. The primary performance claim is limited to canonical SHA-256 full-fallback validation.

Full measured evidence: https://app.perfloop.ai/t/oss/case_6nr6g3vmet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants