MCPcopy
hub / github.com/dgraph-io/dgraph / IntersectCompressedWithLinJump

Function IntersectCompressedWithLinJump

algo/uidlist.go:63–81  ·  view source on GitHub ↗

IntersectCompressedWithLinJump performs the intersection linearly.

(dec *codec.Decoder, v []uint64, o *[]uint64)

Source from the content-addressed store, hash-verified

61
62// IntersectCompressedWithLinJump performs the intersection linearly.
63func IntersectCompressedWithLinJump(dec *codec.Decoder, v []uint64, o *[]uint64) {
64 m := len(v)
65 k := 0
66 _, off := IntersectWithLin(dec.Uids(), v[k:], o)
67 k += off
68
69 for k < m {
70 u := dec.LinearSeek(v[k])
71 if len(u) == 0 {
72 break
73 }
74 _, off := IntersectWithLin(u, v[k:], o)
75 if off == 0 {
76 off = 1 // If v[k] isn't in u, move forward.
77 }
78
79 k += off
80 }
81}
82
83// IntersectCompressedWithBin is based on the paper
84// "Fast Intersection Algorithms for Sorted Sequences"

Calls 3

IntersectWithLinFunction · 0.85
LinearSeekMethod · 0.80
UidsMethod · 0.45