internal/pkg: cache computed identifiers
All checks were successful
Test / Create distribution (push) Successful in 49s
Test / Sandbox (push) Successful in 3m1s
Test / ShareFS (push) Successful in 4m56s
Test / Sandbox (race detector) (push) Successful in 5m21s
Test / Hpkg (push) Successful in 5m30s
Test / Hakurei (push) Successful in 5m53s
Test / Hakurei (race detector) (push) Successful in 7m56s
Test / Flake checks (push) Successful in 1m57s
All checks were successful
Test / Create distribution (push) Successful in 49s
Test / Sandbox (push) Successful in 3m1s
Test / ShareFS (push) Successful in 4m56s
Test / Sandbox (race detector) (push) Successful in 5m21s
Test / Hpkg (push) Successful in 5m30s
Test / Hakurei (push) Successful in 5m53s
Test / Hakurei (race detector) (push) Successful in 7m56s
Test / Flake checks (push) Successful in 1m57s
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>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user