-
Notifications
You must be signed in to change notification settings - Fork 517
Open
Description
During testing and improving of genesis imports/exports I have identified a bottleneck in how genesis imports of contract state is happening specially when there is half million contract instances being imported
Specifically the import of historicalEntries creating unnecessary amount of iterators creating a lot of cpu usage and contention
Lines 803 to 807 in b2294ae
// find last element position | |
var pos uint64 | |
prefixStore := prefix.NewStore(runtime.KVStoreAdapter(store), types.GetContractCodeHistoryElementPrefix(contractAddr)) | |
iter := prefixStore.ReverseIterator(nil, nil) | |
defer iter.Close() |
the appendToContractHistory
can avoid entirely the creation of unnecessary iterators if we assume the entire history has been passed for insertion (there is no pre-existing position as it is the case for a genesis import)
I've ran a patched version jhernandezb@0c31fbc
Let me know if it is ok to submit similar patch
Metadata
Metadata
Assignees
Labels
No labels