Skip to content

Commit

Permalink
[db] avoid clone batch
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie committed Oct 24, 2024
1 parent 5e2cd1d commit efd4085
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions db/batch/batch_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,7 @@ func (b *baseKVStoreBatch) Translate(wit WriteInfoTranslate) KVStoreBatch {
b.mutex.Lock()
defer b.mutex.Unlock()
if wit == nil {
c := &baseKVStoreBatch{
writeQueue: make([]*WriteInfo, b.Size()),
}
// clone the writeQueue
copy(c.writeQueue, b.writeQueue)
return c
return b
}
c := &baseKVStoreBatch{
writeQueue: []*WriteInfo{},
Expand Down

0 comments on commit efd4085

Please sign in to comment.