Skip to content

Cliff/genesis dump optimize#718

Open
cliff0412 wants to merge 29 commits intodev-opfrom
cliff/genesis-dump-optimize
Open

Cliff/genesis dump optimize#718
cliff0412 wants to merge 29 commits intodev-opfrom
cliff/genesis-dump-optimize

Conversation

@cliff0412
Copy link

use multiple threads to scan scalable contracts, reduce scanning time from 46s to 29.6s

image


func processScalableAddressStorageConcurrently(db kv.RwDB, prefix []byte, acct *AccInfo) (uint64, error) {

numWorkers := 32
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use "numWorkers := runtime.NumCPU()"?


for i := 0; i < numChunks; i++ {
startKey := make([]byte, 32)
startKey[0] = byte(i * (256 / numChunks))
Copy link
Collaborator

@Vui-Chee Vui-Chee Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You initialize startKey with 32 bytes, but the the following assignment only assigns the first byte in the array. Is it because workerTx.Range(kv.PlainState, startKey, endKey) requires each key to be 60 bytes long?

Comment on lines +734 to +735
scalableStorageCount, err := processScalableAddressStorageConcurrently(db, k[:28], acc)
acctStorageCount = scalableStorageCount
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we omit scalableStorageCount? And just assign acctStorageCount directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants