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

Get rid of extra requests data copying when calculating requests hash #1092

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

gumb0
Copy link
Member

@gumb0 gumb0 commented Dec 27, 2024

Change Requests representation to byte array of type + requests data.

Closes #1086

@gumb0 gumb0 force-pushed the requests-optimization branch from 739eaa2 to 8db34c8 Compare December 27, 2024 15:57
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.31%. Comparing base (81c9dda) to head (2ce18d2).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1092   +/-   ##
=======================================
  Coverage   94.31%   94.31%           
=======================================
  Files         159      159           
  Lines       17221    17225    +4     
=======================================
+ Hits        16242    16246    +4     
  Misses        979      979           
Flag Coverage Δ
eof_execution_spec_tests 23.62% <32.00%> (+<0.01%) ⬆️
ethereum_tests 26.64% <28.00%> (+0.01%) ⬆️
ethereum_tests_silkpre 18.94% <0.00%> (-0.01%) ⬇️
execution_spec_tests 20.96% <56.00%> (+<0.01%) ⬆️
unittests 89.06% <76.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
test/state/requests.cpp 96.15% <100.00%> (-0.28%) ⬇️
test/state/requests.hpp 90.00% <100.00%> (+15.00%) ⬆️
test/state/system_contracts.cpp 100.00% <100.00%> (ø)
test/t8n/t8n.cpp 88.09% <100.00%> (ø)
test/unittests/state_system_call_test.cpp 100.00% <100.00%> (ø)

@gumb0 gumb0 marked this pull request as ready for review December 27, 2024 16:13
@gumb0 gumb0 requested review from chfast and pdobacz December 27, 2024 16:13
/// Raw encoded data of requests object: first byte is type, the rest is request objects.
evmc::bytes raw_data;

explicit Requests(Type _type, const evmc::bytes& data = {})
Copy link
Member

Choose a reason for hiding this comment

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

Usage of bytes type seems inefficient. In the system_call() we are forced to create a temporary object of bytes just to be quicly replaced with "type + data". It may be better to use bytes_view here.

Copy link
Member Author

Choose a reason for hiding this comment

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

true, I forgot that we can get rid of bytes on the system_call() side

Change Requests representation to byte array of type + requests data.
@gumb0 gumb0 force-pushed the requests-optimization branch from 8db34c8 to 2ce18d2 Compare December 30, 2024 11:48
@gumb0 gumb0 requested a review from chfast December 30, 2024 14:56
@gumb0 gumb0 merged commit a22ef72 into master Dec 30, 2024
25 checks passed
@gumb0 gumb0 deleted the requests-optimization branch December 30, 2024 16:35
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.

Optimize requests hash calculation
2 participants