Skip to content

Commit

Permalink
Use Intersect to Narrow Iterate Range and Reduce Memory Allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Li committed Jan 10, 2025
1 parent a5576a1 commit 17d0349
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion posting/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,7 @@ func (l *List) Uids(opt ListOptions) (*pb.List, error) {
preAllowcateLength = x.MinInt(preAllowcateLength, len(opt.Intersect.Uids))
}
// Pre-assign length to make it faster.
res := make([]uint64, 0, x.MinInt(opt.First, len(opt.Intersect.Uids), l.mutationMap.len()+codec.ApproxLen(l.plist.Pack)))
res := make([]uint64, 0, preAllowcateLength)

checkLimit := func() bool {
// We need the last N.
Expand Down

0 comments on commit 17d0349

Please sign in to comment.