core: add cachedDao to cache accounts and contracts

Importing 100K blocks starting at 1.4M, before this patch:
real    6m0,356s
user    8m52,293s
sys     0m47,372s

After this patch:
real    4m17,748s
user    6m23,316s
sys     0m37,866s

Almost 30% better.
This commit is contained in:
Roman Khimov 2019-12-13 18:43:46 +03:00
parent 212cf44e26
commit 0d0a27d271
4 changed files with 176 additions and 11 deletions

View file

@ -19,12 +19,12 @@ type interopContext struct {
trigger byte
block *Block
tx *transaction.Transaction
dao *dao
dao *cachedDao
notifications []state.NotificationEvent
}
func newInteropContext(trigger byte, bc Blockchainer, s storage.Store, block *Block, tx *transaction.Transaction) *interopContext {
dao := newDao(s)
dao := newCachedDao(s)
nes := make([]state.NotificationEvent, 0)
return &interopContext{bc, trigger, block, tx, dao, nes}
}