Skip to content

MB-70770: Optimize a few APIs in hierarchy search#430

Merged
CascadingRadium merged 9 commits into
masterfrom
optimizeNested
Jun 26, 2026
Merged

MB-70770: Optimize a few APIs in hierarchy search#430
CascadingRadium merged 9 commits into
masterfrom
optimizeNested

Conversation

@CascadingRadium

@CascadingRadium CascadingRadium commented Jun 25, 2026

Copy link
Copy Markdown
Member
  • Optimize countRoot to use bitmap iterator instead of bitmap.Iterate(), avoiding callback overhead.
  • Optimize AddNestedDocuments to take advantage of the monotonic, preorder nature of document numbers of the root and child documents in the segment to avoid repeatedly scanning the entire edge list multiple times.
  • Un-export all edge list methods as they are for internal use only.

@CascadingRadium CascadingRadium changed the title Optimize nested MB-70770: Optimize a few APIs in hierachy search Jun 25, 2026
@CascadingRadium CascadingRadium changed the title MB-70770: Optimize a few APIs in hierachy search MB-70770: Optimize a few APIs in hierarchy search Jun 25, 2026
Likith101
Likith101 previously approved these changes Jun 26, 2026
maneuvertomars
maneuvertomars previously approved these changes Jun 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes nested/hierarchy-related operations in the zap segment implementation by replacing callback-based bitmap iteration, adding precomputed descendant lookups, and making edge-list APIs internal-only.

Changes:

  • Refactors CountRoot() to use internal helpers and an iterator-based root-deleted counter.
  • Reworks AddNestedDocuments() to union precomputed descendant bitmaps instead of repeatedly scanning the edge list.
  • Un-exports edge list APIs and updates merge/test code accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
segment.go Refactors root counting and descendant expansion; introduces internal edgeList()/descendantStore() helpers.
nested_cache.go Builds a descendant store during cache initialization; un-exports edge list types/methods; iterator-based root-deleted counting.
merge.go Updates merge logic to use un-exported edge list APIs.
nested_test.go Updates tests to use un-exported edge list APIs and methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread nested_cache.go
Comment thread segment.go
Comment thread segment.go Outdated
@CascadingRadium CascadingRadium dismissed stale reviews from maneuvertomars and Likith101 via 1bfe82c June 26, 2026 10:41
@CascadingRadium CascadingRadium merged commit 892819a into master Jun 26, 2026
9 checks passed
@CascadingRadium CascadingRadium deleted the optimizeNested branch June 26, 2026 10:55
CascadingRadium added a commit that referenced this pull request Jun 26, 2026
- Optimize `countRoot` to use bitmap iterator instead of
bitmap.Iterate(), avoiding callback overhead.
- Optimize `AddNestedDocuments` to take advantage of the monotonic,
preorder nature of document numbers of the root and child documents in
the segment to avoid repeatedly scanning the entire edge list multiple
times.
- Un-export all edge list methods as they are for internal use only.
CascadingRadium added a commit that referenced this pull request Jun 26, 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.

4 participants