Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshil Goel committed Sep 15, 2023
1 parent d7b759c commit 31f9983
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion algo/uidlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func IntersectCompressedWith(pack *pb.UidPack, afterUID uint64, v, o *pb.List) {

// Select appropriate function based on heuristics.
ratio := float64(m) / float64(n)
if ratio < 10 {
if ratio <= 10 {
IntersectCompressedWithLinJump(&dec, v.Uids, &dst)
} else {
IntersectCompressedWithBin(&dec, v.Uids, &dst)
Expand Down
1 change: 1 addition & 0 deletions algo/uidlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ func BenchmarkListIntersectRandom(b *testing.B) {
func BenchmarkListIntersectCompressBin(b *testing.B) {
randomTests := func(sz int, overlap float64) {
rs := []float64{0.01, 0.1, 1, 10, 100}
//rs := []float64{0.002, 0.01, 0.1}
for _, r := range rs {
sz1 := sz
sz2 := int(float64(sz) * r)
Expand Down
6 changes: 1 addition & 5 deletions codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type Decoder struct {
// NewDecoder returns a decoder for the given UidPack and properly initializes it.
func NewDecoder(pack *pb.UidPack) *Decoder {
decoder := &Decoder{
Pack: pack
Pack: pack,
}
decoder.Seek(0, SeekStart)
return decoder
Expand All @@ -174,10 +174,6 @@ func (d *Decoder) UnpackBlock() []uint64 {
return d.uids
}

if val, ok := d.UnpackedBlocks[d.blockIdx]; ok {
return val
}

block := d.Pack.Blocks[d.blockIdx]

last := block.Base
Expand Down
6 changes: 1 addition & 5 deletions posting/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (it *pIterator) seek(l *List, afterUid, deleteBelowTs uint64) error {
}

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

Expand Down Expand Up @@ -1180,11 +1180,7 @@ func (l *List) Uids(opt ListOptions) (*pb.List, error) {
l.RUnlock()
return out, ErrTsTooOld
}
//if len(opt.Intersect.Uids) > 10*codec.ApproxLen(l.plist.Pack) {
// algo.IntersectCompressedWithAlternate(l.plist.Pack, opt.AfterUid, opt.Intersect, out)
//} else {
algo.IntersectCompressedWith(l.plist.Pack, opt.AfterUid, opt.Intersect, out)
//}
l.RUnlock()
return out, nil
}
Expand Down

0 comments on commit 31f9983

Please sign in to comment.