Improve updateTradesHistory performance#84
Open
primersion wants to merge 3 commits intohive-engine:qafrom
Open
Improve updateTradesHistory performance#84primersion wants to merge 3 commits intohive-engine:qafrom
primersion wants to merge 3 commits intohive-engine:qafrom
Conversation
bt-cryptomancer
requested changes
Jan 19, 2025
Contributor
bt-cryptomancer
left a comment
There was a problem hiding this comment.
Mostly looks good (see one comment below). However, I'd like to see a before & after test case added to do a bit of profiling to see how much of a difference this makes. You could have a test case that does, say, 10,000 trades, then update the block time and measure how long in ms it takes to clean up the tradesHistory table. Then deploy the updated contract and measure again to see if there is a noticeable difference with this change.
Also, can you look into why this didn't pass all the automated github tests?
| await removeBadOrders(); | ||
| await removeBlacklistedOrders('buy', 'waitingforlove'); | ||
| await removeBlacklistedOrders('sell', 'waitingforlove'); | ||
| await api.db.addIndexes('tradesHistory', [{ name: 'timestamp', index: { timestamp: 1 } }]); |
Contributor
There was a problem hiding this comment.
Can you gate this new index addition behind a params.updateIndex check in the same way as the mining contract?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR tries to improve the
updateTradesHistorymethod of themarketcontract:timestampcolumn of themarket_tradesHistorytableupdateVolumeMetriconly once