From 56da830237343b9741d6704485f7d0b2d67a52a3 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Thu, 5 Nov 2026 10:39:48 +0000 Subject: [PATCH] perf: decode query output in batches of 1024 messages instead of 8192 A decoded rule keeps every attribute until the batch transform prehashes it, so the batch message bound sets most of generate-hashes' peak memory. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KJs3XyqYbgHB2A1m6gVsRn --- src/bazel.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bazel.rs b/src/bazel.rs index 07026a89..3858ba42 100644 --- a/src/bazel.rs +++ b/src/bazel.rs @@ -2649,7 +2649,14 @@ pub fn decode_delimited(path: &Path) -> Result> { /// Upper bounds on one decode batch. Batching keeps peak memory proportional to /// the batch rather than to the whole query output, which for a large workspace /// is gigabytes. -const DECODE_BATCH_MESSAGES: usize = 8192; +/// +/// A decoded rule still carries every attribute (implicit ones included, several +/// hundred bytes each) until the batch transform prehashes and drops them, so the +/// message bound sets most of the decode peak. On the large perf-proof workload, +/// 8192 instead of 1024 raised generate-hashes' peak RSS from about 160 to 245 MiB; +/// below 1024 the peak no longer moves, and each batch stays large enough to decode +/// in parallel. +const DECODE_BATCH_MESSAGES: usize = 1024; const DECODE_BATCH_BYTES: usize = 32 * 1024 * 1024; /// Raw, still-encoded messages read off the stream, kept in one contiguous