|
|
@ -151,7 +151,6 @@ type StateDB struct { |
|
|
|
AccountUpdates time.Duration |
|
|
|
AccountUpdates time.Duration |
|
|
|
AccountCommits time.Duration |
|
|
|
AccountCommits time.Duration |
|
|
|
StorageReads time.Duration |
|
|
|
StorageReads time.Duration |
|
|
|
StorageHashes time.Duration |
|
|
|
|
|
|
|
StorageUpdates time.Duration |
|
|
|
StorageUpdates time.Duration |
|
|
|
StorageCommits time.Duration |
|
|
|
StorageCommits time.Duration |
|
|
|
SnapshotAccountReads time.Duration |
|
|
|
SnapshotAccountReads time.Duration |
|
|
@ -856,6 +855,7 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash { |
|
|
|
// the account prefetcher. Instead, let's process all the storage updates
|
|
|
|
// the account prefetcher. Instead, let's process all the storage updates
|
|
|
|
// first, giving the account prefetches just a few more milliseconds of time
|
|
|
|
// first, giving the account prefetches just a few more milliseconds of time
|
|
|
|
// to pull useful data from disk.
|
|
|
|
// to pull useful data from disk.
|
|
|
|
|
|
|
|
start := time.Now() |
|
|
|
for addr, op := range s.mutations { |
|
|
|
for addr, op := range s.mutations { |
|
|
|
if op.applied { |
|
|
|
if op.applied { |
|
|
|
continue |
|
|
|
continue |
|
|
@ -865,6 +865,8 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash { |
|
|
|
} |
|
|
|
} |
|
|
|
s.stateObjects[addr].updateRoot() |
|
|
|
s.stateObjects[addr].updateRoot() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
s.StorageUpdates += time.Since(start) |
|
|
|
|
|
|
|
|
|
|
|
// Now we're about to start to write changes to the trie. The trie is so far
|
|
|
|
// Now we're about to start to write changes to the trie. The trie is so far
|
|
|
|
// _untouched_. We can check with the prefetcher, if it can give us a trie
|
|
|
|
// _untouched_. We can check with the prefetcher, if it can give us a trie
|
|
|
|
// which has the same root, but also has some content loaded into it.
|
|
|
|
// which has the same root, but also has some content loaded into it.
|
|
|
@ -1151,6 +1153,7 @@ func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool) (common.Hash, er |
|
|
|
return common.Hash{}, err |
|
|
|
return common.Hash{}, err |
|
|
|
} |
|
|
|
} |
|
|
|
// Handle all state updates afterwards
|
|
|
|
// Handle all state updates afterwards
|
|
|
|
|
|
|
|
start := time.Now() |
|
|
|
for addr, op := range s.mutations { |
|
|
|
for addr, op := range s.mutations { |
|
|
|
if op.isDelete() { |
|
|
|
if op.isDelete() { |
|
|
|
continue |
|
|
|
continue |
|
|
@ -1179,13 +1182,15 @@ func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool) (common.Hash, er |
|
|
|
storageTrieNodesDeleted += deleted |
|
|
|
storageTrieNodesDeleted += deleted |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
s.StorageCommits += time.Since(start) |
|
|
|
|
|
|
|
|
|
|
|
if codeWriter.ValueSize() > 0 { |
|
|
|
if codeWriter.ValueSize() > 0 { |
|
|
|
if err := codeWriter.Write(); err != nil { |
|
|
|
if err := codeWriter.Write(); err != nil { |
|
|
|
log.Crit("Failed to commit dirty codes", "error", err) |
|
|
|
log.Crit("Failed to commit dirty codes", "error", err) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// Write the account trie changes, measuring the amount of wasted time
|
|
|
|
// Write the account trie changes, measuring the amount of wasted time
|
|
|
|
start := time.Now() |
|
|
|
start = time.Now() |
|
|
|
|
|
|
|
|
|
|
|
root, set, err := s.trie.Commit(true) |
|
|
|
root, set, err := s.trie.Commit(true) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|