-
Notifications
You must be signed in to change notification settings - Fork 152
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
Short-circuit evaluation of stale actions on reorg #970
Merged
Conversation
This file contains 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
Codecov Report
@@ Coverage Diff @@
## main #970 +/- ##
==========================================
- Coverage 88.81% 87.74% -1.07%
==========================================
Files 288 288
Lines 26766 26588 -178
==========================================
- Hits 23771 23329 -442
- Misses 1466 1730 +264
Partials 1529 1529
|
longfin
previously approved these changes
Aug 27, 2020
/rebase |
earlbread
reviewed
Aug 28, 2020
84e0848
to
f847a72
Compare
@planetarium/libplanet Applied suggestions and rebased on the up-to-date main. Please review this again! |
earlbread
previously approved these changes
Aug 28, 2020
moreal
reviewed
Aug 28, 2020
f847a72
to
7c76020
Compare
@earlbread @moreal Fixed a typo. Please review this again. |
earlbread
previously approved these changes
Aug 28, 2020
moreal
previously approved these changes
Aug 28, 2020
limebell
previously approved these changes
Aug 28, 2020
riemannulus
previously approved these changes
Aug 28, 2020
This implements the equivalent optimization made by the following issue: planetarium#883 Fixes planetarium#967
fbf1e7f
7c76020
to
fbf1e7f
Compare
@planetarium/libplanet Rebased again! |
earlbread
approved these changes
Aug 28, 2020
longfin
approved these changes
Aug 28, 2020
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 addresses #967.
The previous patch #963 unified two types of events into one: one is for rendering/unrendering actions, and other one is for watching new tips & reorgs. At the same time, it also threw away the
BlockChain<T>()
constructor's Boolean optionrender
because I thought it's redundant asrender: false
seemed equivalent torenderers: null
.However, those two changes regressed the performance of reorg, because the optimization made by the patch #883 was thrown away together. The disappeared optimization was a short-circuit evaluation option for stale actions to be unrendered. As the option
render: false
was removed, stale actions became evaluated even if there is no renderers, or all renderers do nothing forUnrenderAction()
/UnrenderActionError()
events…In order to fix this performance regression, I reverted (with some adjusts and new name)
ShortCircuitActionEvaluationForUnrenderWithNoActionRenderers
(wasRender
) test, I removed in the previous patch #963, and refactored the renderer interface(s) according to the conclusion made in the issue #967. Now we have a new interface namedIActionRenderer<T>
, is basically equivalent to the previousIRenderer<T>
, andIRenderer<T>
became to have only block-related events.BlockChain<T>.Swap()
now omits evaluation of stale actions if there is noIActionRenderer<T>
at all.