Skip to content

Commit 31f9983

Browse files
author
Harshil Goel
committed
temp
1 parent d7b759c commit 31f9983

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

algo/uidlist.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func IntersectCompressedWith(pack *pb.UidPack, afterUID uint64, v, o *pb.List) {
6060

6161
// Select appropriate function based on heuristics.
6262
ratio := float64(m) / float64(n)
63-
if ratio < 10 {
63+
if ratio <= 10 {
6464
IntersectCompressedWithLinJump(&dec, v.Uids, &dst)
6565
} else {
6666
IntersectCompressedWithBin(&dec, v.Uids, &dst)

algo/uidlist_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ func BenchmarkListIntersectRandom(b *testing.B) {
370370
func BenchmarkListIntersectCompressBin(b *testing.B) {
371371
randomTests := func(sz int, overlap float64) {
372372
rs := []float64{0.01, 0.1, 1, 10, 100}
373+
//rs := []float64{0.002, 0.01, 0.1}
373374
for _, r := range rs {
374375
sz1 := sz
375376
sz2 := int(float64(sz) * r)

codec/codec.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ type Decoder struct {
156156
// NewDecoder returns a decoder for the given UidPack and properly initializes it.
157157
func NewDecoder(pack *pb.UidPack) *Decoder {
158158
decoder := &Decoder{
159-
Pack: pack
159+
Pack: pack,
160160
}
161161
decoder.Seek(0, SeekStart)
162162
return decoder
@@ -174,10 +174,6 @@ func (d *Decoder) UnpackBlock() []uint64 {
174174
return d.uids
175175
}
176176

177-
if val, ok := d.UnpackedBlocks[d.blockIdx]; ok {
178-
return val
179-
}
180-
181177
block := d.Pack.Blocks[d.blockIdx]
182178

183179
last := block.Base

posting/list.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func (it *pIterator) seek(l *List, afterUid, deleteBelowTs uint64) error {
141141
}
142142

143143
it.uidPosting = &pb.Posting{}
144-
it.dec = &codec.Decoder{Pack: it.plist.Pack, UnpackedBlocks: make(map[int][]uint64)}
144+
it.dec = &codec.Decoder{Pack: it.plist.Pack}
145145
it.uids = it.dec.Seek(it.afterUid, codec.SeekCurrent)
146146
it.uidx = 0
147147

@@ -1180,11 +1180,7 @@ func (l *List) Uids(opt ListOptions) (*pb.List, error) {
11801180
l.RUnlock()
11811181
return out, ErrTsTooOld
11821182
}
1183-
//if len(opt.Intersect.Uids) > 10*codec.ApproxLen(l.plist.Pack) {
1184-
// algo.IntersectCompressedWithAlternate(l.plist.Pack, opt.AfterUid, opt.Intersect, out)
1185-
//} else {
11861183
algo.IntersectCompressedWith(l.plist.Pack, opt.AfterUid, opt.Intersect, out)
1187-
//}
11881184
l.RUnlock()
11891185
return out, nil
11901186
}

0 commit comments

Comments
 (0)