Skip to content

Commit

Permalink
groot/rtree: reduce memory usage in tree-write
Browse files Browse the repository at this point in the history
only keep one basket when writing.
this also reduces somewhat the on-disk size of TBranches.
  • Loading branch information
sbinet committed Nov 25, 2020
1 parent 8c71fb8 commit 1d1c78d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions groot/rtree/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,11 +711,10 @@ func (b *tbranch) setStreamerElement(s rbytes.StreamerElement, ctx rbytes.Stream
}

func (b *tbranch) createNewBasket() {
b.writeBasket = len(b.baskets)
cycle := int16(b.writeBasket)
b.baskets = append(b.baskets, newBasketFrom(b.tree, b, cycle, b.basketSize, b.entryOffsetLen))
b.ctx.bk = &b.baskets[b.writeBasket]
if n := len(b.baskets); n > b.maxBaskets {
cycle := int16(b.writeBasket) + 1
bk := newBasketFrom(b.tree, b, cycle, b.basketSize, b.entryOffsetLen)
b.ctx.bk = &bk
if n := b.writeBasket; n > b.maxBaskets {
b.maxBaskets = n
}
}
Expand Down

0 comments on commit 1d1c78d

Please sign in to comment.