From a40527dcb2197e4a3b41a98ed319563171703c66 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 17 Feb 2026 14:38:42 +0900 Subject: [PATCH] internal/pkg/ir: document reason for avoiding ident cache 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 --- internal/pkg/ir.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/pkg/ir.go b/internal/pkg/ir.go index 58dcbfe..73315a8 100644 --- a/internal/pkg/ir.go +++ b/internal/pkg/ir.go @@ -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.