Skip to content

refactor: simplify estimated_size accounting - #302

Draft
tisonkun wants to merge 4 commits into
apache:mainfrom
tisonkun:refactor/estimated-size
Draft

tisonkun wants to merge 4 commits into
apache:mainfrom
tisonkun:refactor/estimated-size

Conversation

@tisonkun

@tisonkun tisonkun commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Simplify the current estimated_size implementations while keeping all 17 public documentation comments implementation-neutral.
  • Include size_of::<P>() for TupleSketch and the shared union/intersection state so potentially large inline policy payloads are represented. Built-in zero-sized policies are unchanged.
  • Keep CpcWrapper without estimated_size: it contains only fixed-size cardinality metadata and owns no variable-sized storage.
  • Unify all 11 internal helper comments as Returns an estimate of memory usage in bytes.
  • Convert size assertions to literal snapshot values rather than deriving expectations from formulas. Retain non-circular behavioral comparisons for buffer reuse, shallow generic values, and policy-size coverage.
  • Describe the result in the changelog as implementation-dependent rather than a stable accounting contract.

Implementation notes

The inline audit found no configuration-scaled inline buffers in the covered types. Substantial variable-sized state is owned by Vec or Box<[T]>. Custom Tuple policies can have large inline payloads and are now included through size_of::<P>(); generic values' recursively owned allocations remain a separate design topic in #193.

No KLL/REQ methods are added. Public method documentation remains a single sentence that does not prescribe heap, inline layout, capacity, or generic traversal rules.

Validation

  • cargo x check
  • cargo x test
  • cargo x lint

@tisonkun
tisonkun marked this pull request as draft October 24, 2026 02:00
@tisonkun tisonkun changed the title docs: clarify estimated_size accounting refactor: base estimated_size on heap storage Oct 24, 2026
@tisonkun tisonkun changed the title refactor: base estimated_size on heap storage refactor: simplify estimated_size accounting Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant