-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
performance: turn cache misses during assembly into cache hits during eval #4617
Conversation
988803e
to
93a1624
Compare
Codecov Report
@@ Coverage Diff @@
## master #4617 +/- ##
==========================================
- Coverage 54.55% 54.37% -0.19%
==========================================
Files 414 407 -7
Lines 53607 52389 -1218
==========================================
- Hits 29244 28485 -759
+ Misses 21935 21525 -410
+ Partials 2428 2379 -49
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
93a1624
to
02dccd7
Compare
dcd4447
to
0c2e549
Compare
@@ -94,6 +95,7 @@ var DefaultConfig = PpConfig{ | |||
RandomizeFee: false, | |||
RandomizeAmt: false, | |||
RandomizeDst: false, | |||
MaxRandomDst: 200000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix two remarks and this is good to go
0c2e549
to
974968e
Compare
|
||
au.baseAccounts.flushPendingWrites() | ||
au.baseResources.flushPendingWrites() | ||
au.baseKVs.flushPendingWrites() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebased on master to get the boxes feature and added a flush on the baseKVs LRU.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this was already merged, but wanted to note a couple thnigs.
Biggest comment is on code that isn't here. Although boxes were rebased into this, I don't see the analogous changes for lrukv.go.
au.baseResources.flushPendingWrites() | ||
au.baseKVs.flushPendingWrites() | ||
|
||
au.accountsMu.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer defer?
@@ -1327,6 +1340,12 @@ func (au *accountUpdates) lookupResource(rnd basics.Round, addr basics.Address, | |||
return macct.AccountResource(), rnd, nil | |||
} | |||
|
|||
// check baseAccoiunts again to see if it does not exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"baseResources"
@@ -1428,6 +1448,12 @@ func (au *accountUpdates) lookupWithoutRewards(rnd basics.Round, addr basics.Add | |||
return macct.accountData.GetLedgerCoreAccountData(), rnd, rewardsVersion, rewardsLevel, nil | |||
} | |||
|
|||
// check baseAccoiunts again to see if it does not exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"baseAccounts" (sp)
@@ -117,5 +152,8 @@ func (m *lruAccounts) prune(newSize int) (removed int) { | |||
m.accountsList.remove(back) | |||
removed++ | |||
} | |||
|
|||
// clear the notFound list | |||
m.notFound = make(map[basics.Address]struct{}, len(m.notFound)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supposedly, deleting in a loop over all keys is recognized by the compiler and optimized to be cheaper than reallocating. @cce posted something about it. https://go-review.googlesource.com/c/go/+/110055
@@ -139,5 +174,8 @@ func (m *lruResources) prune(newSize int) (removed int) { | |||
m.resourcesList.remove(back) | |||
removed++ | |||
} | |||
|
|||
// clear the notFound list | |||
m.notFound = make(map[accountCreatable]struct{}, len(m.notFound)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Summary
The problem statement applies both to accounts and resources.
Additionally, we taught the LRU to track accounts and resources that were not found in the DB.
Thus avoiding repeated DB queries on objects that do not exist.
Test Plan
Benchmark on
scenario-1s
We run the scenario-1s with the default script and using a random destination (max200k) both on master and this branch.
The transactions per second (TPS) results are shown in figure 1.