From 3499a82785f8cb82bfe528875391d76d5e03c3de Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 15 Jan 2026 22:05:24 +0900 Subject: internal/pkg: cache computed identifiers This eliminates duplicate identifier computations. The new implementation also significantly reduces allocations while computing identifier for a large dependency tree. Signed-off-by: Ophestra --- internal/pkg/tar.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/pkg/tar.go') diff --git a/internal/pkg/tar.go b/internal/pkg/tar.go index eda41401..faad4854 100644 --- a/internal/pkg/tar.go +++ b/internal/pkg/tar.go @@ -70,9 +70,9 @@ func NewHTTPGetTar( // Kind returns the hardcoded [Kind] constant. func (a *tarArtifact) Kind() Kind { return KindTar } -// Params returns compression encoded in little endian. -func (a *tarArtifact) Params() []byte { - return binary.LittleEndian.AppendUint64(nil, a.compression) +// Params writes compression encoded in little endian. +func (a *tarArtifact) Params(ctx *IContext) { + ctx.GetHash().Write(binary.LittleEndian.AppendUint64(nil, a.compression)) } // Dependencies returns a slice containing the backing file. -- cgit v1.3.1