internal/pkg/ir: document reason for avoiding ident cache
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 1m49s
Test / ShareFS (push) Successful in 2m55s
Test / Hakurei (push) Successful in 3m7s
Test / Hpkg (push) Successful in 3m36s
Test / Sandbox (race detector) (push) Successful in 5m3s
Test / Hakurei (race detector) (push) Successful in 6m19s
Test / Flake checks (push) Successful in 1m41s

This got brought up earlier today as a potential optimisation. This change documents why it is not viable, and hopefully clears up some performance implications of using IRDecoder, namely that its decoding costs do not amortise.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-02-17 14:38:42 +09:00
parent 88d9a6163e
commit a40527dcb2

View File

@@ -310,6 +310,13 @@ type (
// verbose logging is enabled. Artifacts may only depend on artifacts
// previously described in the IR stream.
//
// IRDecoder rejects an IR stream on the first decoding error, it does not
// check against nonzero reserved ancillary data or incorrectly ordered or
// redundant unstructured dependencies. An invalid IR stream as such will
// yield [Artifact] values with identifiers disagreeing with those computed
// by IRDecoder. For this reason, IRDecoder does not access the ident cache
// to avoid putting [Cache] into an inconsistent state.
//
// Methods of IRDecoder are not safe for concurrent use.
IRDecoder struct {
// Address of underlying [Cache], must not be exposed directly.