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

feat(db): improve performance for getting transaction hash #4792

Merged

Conversation

halibobo1205
Copy link
Contributor

@halibobo1205 halibobo1205 commented Nov 15, 2022

What does this PR do?

 add cache for transaction hash, hash is computed from  raw_data , update hash when raw_data is update

Why are these changes required?

 reduce unnecessary method calls

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2022

Codecov Report

Merging #4792 (af64790) into develop (82c40b4) will decrease coverage by 0.49%.
The diff coverage is 76.92%.

@@              Coverage Diff              @@
##             develop    #4792      +/-   ##
=============================================
- Coverage      54.22%   53.72%   -0.50%     
+ Complexity      8048     7980      -68     
=============================================
  Files            833      833              
  Lines          47707    47713       +6     
  Branches        5183     5183              
=============================================
- Hits           25871    25636     -235     
- Misses         19780    20024     +244     
+ Partials        2056     2053       -3     
Impacted Files Coverage Δ
...java/org/tron/core/capsule/TransactionCapsule.java 51.42% <76.92%> (+0.22%) ⬆️
...n/common/net/udp/message/discover/PongMessage.java 0.00% <0.00%> (-90.00%) ⬇️
...org/tron/common/net/udp/handler/PacketDecoder.java 11.76% <0.00%> (-47.06%) ⬇️
.../java/org/tron/common/net/udp/message/Message.java 26.08% <0.00%> (-34.79%) ⬇️
...n/common/net/udp/message/discover/PingMessage.java 63.33% <0.00%> (-30.01%) ⬇️
...udp/message/discover/DiscoverMessageInspector.java 0.00% <0.00%> (-29.73%) ⬇️
...rg/tron/common/net/udp/handler/MessageHandler.java 73.33% <0.00%> (-26.67%) ⬇️
...tron/common/overlay/discover/node/NodeManager.java 53.28% <0.00%> (-21.06%) ⬇️
...src/main/java/org/tron/core/db/PendingManager.java 34.88% <0.00%> (-16.28%) ⬇️
.../java/org/tron/core/consensus/BlockHandleImpl.java 65.00% <0.00%> (-15.00%) ⬇️
... and 26 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@halibobo1205
Copy link
Contributor Author

trace processBlock

---[736.685476ms] org.tron.core.db.Manager:processBlock()
        +---[77.66% ,total=572.11554ms,count=4847] org.tron.core.db.Manager:processTransaction() 
        +---[0.84% 6.191346ms ] org.tron.common.zksnark.MerkleContainer:saveCurrentMerkleTreeAsBestMerkleTree() 
        +---[2.89% 21.25774ms ] org.tron.core.db.Manager:payReward() 
        +---[3.78% 27.817114ms ] org.tron.core.db.Manager:updateTransHashCache() 
        +---[4.31% 31.786317ms ] org.tron.core.db.Manager:updateRecentTransaction() #4132 

@halibobo1205 halibobo1205 marked this pull request as ready for review November 24, 2022 07:16
@halibobo1205 halibobo1205 merged commit b421d0b into tronprotocol:develop Nov 30, 2022
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.

4 participants