Use pooled bitmaps (#5946)

This commit is contained in:
Willian Mitsuda 2022-11-03 02:50:16 -03:00 committed by GitHub
parent 11f4978ed4
commit 84ac1b919c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,8 +6,8 @@ import (
"fmt" "fmt"
"sort" "sort"
"github.com/RoaringBitmap/roaring/roaring64"
"github.com/ledgerwatch/erigon-lib/kv" "github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/bitmapdb"
"github.com/ledgerwatch/erigon/common" "github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/common/changeset" "github.com/ledgerwatch/erigon/common/changeset"
"github.com/ledgerwatch/erigon/core/state" "github.com/ledgerwatch/erigon/core/state"
@ -73,7 +73,8 @@ func (api *OtterscanAPIImpl) GetContractCreator(ctx context.Context, addr common
} }
var acc accounts.Account var acc accounts.Account
bm := roaring64.NewBitmap() bm := bitmapdb.NewBitmap64()
defer bitmapdb.ReturnToPool64(bm)
prevShardMaxBl := uint64(0) prevShardMaxBl := uint64(0)
for { for {
_, err := bm.ReadFrom(bytes.NewReader(v)) _, err := bm.ReadFrom(bytes.NewReader(v))