Skip to content
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

perf: fix to use easyjson instead of amino when marshal abci logs #208

Merged
merged 7 commits into from
May 27, 2021

Conversation

wetcod
Copy link
Contributor

@wetcod wetcod commented May 26, 2021

Description

I found a bottleneck in runMsgs, the process of converting the Result.Log to a string.
( https://github.com/line/lbm-sdk/blob/v2/develop/baseapp/baseapp.go#L767 )
When marshaling Result.Log with JSON, it takes a long time because many reflects are generated by amino codec.
Since Result.Log is not registered in amino codec as RegisterConcrete, it has the same format as json.
So, instead of using reflects, change it to use the MarshalJSON function created with easyjson.
(In the case of the types registered in amino codec with RegisterConcrete, easyjson must not be used.)

Profile

AS-IS

image

TO-BE

image

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@wetcod wetcod force-pushed the sangyeop/v2/apply-easyjson branch from fbd2898 to 9f17215 Compare May 26, 2021 10:46
@wetcod wetcod force-pushed the sangyeop/v2/apply-easyjson branch from 9f17215 to 114399f Compare May 26, 2021 10:46
@codecov
Copy link

codecov bot commented May 26, 2021

Codecov Report

Merging #208 (2862b47) into v2/develop (88ab1bd) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff               @@
##           v2/develop     #208      +/-   ##
==============================================
- Coverage       53.49%   53.48%   -0.01%     
==============================================
  Files             653      652       -1     
  Lines           47376    47345      -31     
==============================================
- Hits            25343    25324      -19     
+ Misses          19178    19167      -11     
+ Partials         2855     2854       -1     
Impacted Files Coverage Δ
baseapp/baseapp.go 77.94% <ø> (+0.85%) ⬆️
simapp/app.go 83.96% <ø> (+0.16%) ⬆️
store/cache/cache.go 88.88% <ø> (+0.65%) ⬆️
store/cachekv/store.go 91.34% <ø> (+4.21%) ⬆️
store/iavl/store.go 66.36% <ø> (+0.29%) ⬆️
store/rootmulti/store.go 65.25% <ø> (-0.72%) ⬇️
store/types/gas.go 75.00% <ø> (+1.82%) ⬆️
store/types/store.go 58.82% <ø> (-1.18%) ⬇️
types/context.go 96.15% <ø> (+1.21%) ⬆️
types/result.go 81.69% <ø> (-1.29%) ⬇️
... and 15 more

@wetcod wetcod self-assigned this May 26, 2021
Copy link

@egonspace egonspace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wetcod wetcod merged commit 0cb8676 into v2/develop May 27, 2021
@wetcod wetcod deleted the sangyeop/v2/apply-easyjson branch May 27, 2021 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants