Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions rust/lance-index/src/scalar/inverted/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1451,10 +1451,6 @@ impl PostingListReader {
pub struct Positions(ListArray);

impl DeepSizeOf for Positions {
fn deep_size_of(&self) -> usize {
self.0.get_array_memory_size()
}

fn deep_size_of_children(&self, _context: &mut deepsize::Context) -> usize {
self.0.get_buffer_memory_size()
}
Expand Down Expand Up @@ -1619,7 +1615,7 @@ impl DeepSizeOf for PlainPostingList {
+ self
.positions
.as_ref()
.map(|positions| positions.get_array_memory_size())
.map(|positions| positions.get_buffer_memory_size())
.unwrap_or(0)
}
}
Expand Down Expand Up @@ -1716,11 +1712,11 @@ pub struct CompressedPostingList {

impl DeepSizeOf for CompressedPostingList {
fn deep_size_of_children(&self, _context: &mut deepsize::Context) -> usize {
self.blocks.get_array_memory_size()
self.blocks.get_buffer_memory_size()
+ self
.positions
.as_ref()
.map(|positions| positions.get_array_memory_size())
.map(|positions| positions.get_buffer_memory_size())
Comment on lines +1715 to +1719
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include compressed position buffers in deep size

Switching positions to get_buffer_memory_size() means the deep size now counts only the outer list’s offset/null buffers and omits the buffers of the inner LargeBinaryArray that hold the compressed positions themselves. Because CompressedPostingList has no other deep-size traversal, any posting list with positions will have most of its memory (the compressed position payloads) ignored when the cache computes weights, so cache limits can be exceeded whenever positions are present.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex is wrong here. I agree with you that get_buffer_memory_size is correct. The array structure itself will already be included.

.unwrap_or(0)
}
}
Expand Down