From 9b579069dff3e6b18b64567cf679c2d80f03e77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 23 Jan 2025 11:09:20 +0100 Subject: [PATCH] Comment the max grant of the bbqueue Co-authored-by: Louis Dureuil --- crates/milli/src/update/new/channel.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/milli/src/update/new/channel.rs b/crates/milli/src/update/new/channel.rs index c362075a5..7e2229950 100644 --- a/crates/milli/src/update/new/channel.rs +++ b/crates/milli/src/update/new/channel.rs @@ -59,7 +59,8 @@ pub fn extractor_writer_bbqueue( bbbuffers.resize_with(current_num_threads, || BBBuffer::new(bbbuffer_capacity)); let capacity = bbbuffers.first().unwrap().capacity(); - // Read the const description to understand this + // 1. Due to fragmentation in the bbbuffer, we can only accept up to half the capacity in a single message. + // 2. Read the documentation for `MAX_FRAME_HEADER_SIZE` for more information about why it is here. let max_grant = capacity.saturating_div(2).checked_sub(MAX_FRAME_HEADER_SIZE).unwrap(); let producers = ThreadLocal::with_capacity(bbbuffers.len());