diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-15 22:05:24 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-15 23:30:43 +0900 |
| commit | 3499a82785f8cb82bfe528875391d76d5e03c3de (patch) | |
| tree | 66d82b1a95fc3137cfb7a2ffa82af0d84b613aa0 /internal/pkg/tar.go | |
| parent | 088d35e4e65f1a22d32ac66d223672ed923fa328 (diff) | |
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 <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/tar.go')
| -rw-r--r-- | internal/pkg/tar.go | 6 |
1 files changed, 3 insertions, 3 deletions
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. |
