internal/pkgbits: mark element / section ends as delta encoding candidates

Change-Id: I165c98a0a5800515bfa33c60b95b534900d0ea59
Reviewed-on: https://go-review.googlesource.com/c/go/+/675215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mark Freeman <mark@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
Mark Freeman 2025-05-21 15:13:45 -04:00 committed by Gopher Robot
parent a1a1514965
commit b6e251b264
1 changed files with 5 additions and 2 deletions

View File

@ -72,14 +72,17 @@ func (pw *PkgEncoder) DumpTo(out0 io.Writer) (fingerprint [8]byte) {
writeUint32(flags)
}
// Write elemEndsEnds.
// TODO(markfreeman): Also can use delta encoding to write section ends,
// but not as impactful.
var sum uint32
for _, elems := range &pw.elems {
sum += uint32(len(elems))
writeUint32(sum)
}
// Write elemEnds.
// TODO(markfreeman): Use delta encoding to store element ends and inflate
// back to this representation during decoding; the numbers will be much
// smaller.
sum = 0
for _, elems := range &pw.elems {
for _, elem := range elems {