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

Pre-populate []transactions into collectionItem #3804

Merged
merged 1 commit into from
Jan 13, 2023
Merged

Conversation

pattyshack
Copy link
Contributor

This is both prep work for flattening transaction execution loops and prep work for pre-computing / caching txnId for tracing (see #3793)

@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2023

FVM Benchstat comparison

This branch with compared with the base branch onflow:master commit 2c53333

The command (for i in {1..7}; do go test ./fvm ./engine/execution/computation --bench . --tags relic -shuffle=on --benchmem --run ^$; done) was used.

Collapsed results for better readability

old.txtnew.txt
time/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-230.0ms ± 3%31.0ms ± 5%+3.45%(p=0.022 n=6+7)
RuntimeTransaction/convert_int_to_string-231.5ms ± 3%32.1ms ± 6%~(p=0.731 n=6+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-232.6ms ± 4%32.8ms ± 3%~(p=0.699 n=6+6)
RuntimeTransaction/get_signer_address-230.5ms ± 2%30.8ms ± 4%~(p=0.589 n=6+6)
RuntimeTransaction/get_public_account-233.0ms ± 4%33.5ms ± 2%~(p=0.445 n=7+6)
RuntimeTransaction/get_account_and_get_balance-2268ms ± 2%267ms ± 2%~(p=0.620 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-2244ms ± 2%247ms ± 4%~(p=0.318 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-235.0ms ± 4%35.3ms ± 4%~(p=1.000 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-2220ms ± 2%221ms ± 2%~(p=0.710 n=7+7)
RuntimeTransaction/get_signer_vault-237.5ms ± 4%37.5ms ± 3%~(p=1.000 n=7+7)
RuntimeTransaction/get_signer_receiver-247.4ms ± 6%47.6ms ± 6%~(p=0.620 n=7+7)
RuntimeTransaction/transfer_tokens-2194ms ± 2%193ms ± 1%~(p=0.456 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-236.3ms ± 2%36.6ms ± 3%~(p=0.295 n=6+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-278.2ms ± 4%79.0ms ± 3%~(p=0.456 n=7+7)
RuntimeTransaction/create_new_account-2818ms ± 1%823ms ± 2%~(p=0.383 n=7+7)
RuntimeTransaction/call_empty_contract_function-233.4ms ± 3%32.7ms ± 3%~(p=0.073 n=7+7)
RuntimeTransaction/emit_event-248.0ms ± 3%47.4ms ± 5%~(p=0.620 n=7+7)
RuntimeTransaction/borrow_array_from_storage-2129ms ± 2%128ms ± 3%~(p=0.383 n=7+7)
RuntimeTransaction/copy_array_from_storage-2129ms ± 1%128ms ± 2%~(p=0.128 n=7+7)
RuntimeNFTBatchTransfer-2116ms ± 4%119ms ± 4%~(p=0.101 n=6+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-24.39s ± 0%4.37s ± 1%~(p=0.445 n=6+7)
 
computationdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-2202 ± 0%202 ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2502 ± 0%502 ± 0%~(all equal)
RuntimeTransaction/get_signer_address-2302 ± 0%302 ± 0%~(all equal)
RuntimeTransaction/get_public_account-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_balance-21.00k ± 0%1.00k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_available_balance-23.10k ± 0%3.10k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-21.70k ± 0%1.70k ± 0%~(all equal)
RuntimeTransaction/get_signer_vault-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_signer_receiver-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/transfer_tokens-23.50k ± 0%3.50k ± 0%~(all equal)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/create_new_account-2202 ± 0%202 ± 0%~(all equal)
RuntimeTransaction/call_empty_contract_function-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/emit_event-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/borrow_array_from_storage-22.60k ± 0%2.60k ± 0%~(all equal)
RuntimeTransaction/copy_array_from_storage-22.60k ± 0%2.60k ± 0%~(all equal)
 
interactionsdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_signer_address-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_public_account-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_balance-224.3M ± 0%24.3M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_available_balance-25.64M ± 0%5.64M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-25.64M ± 0%5.64M ± 0%~(all equal)
RuntimeTransaction/get_signer_vault-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_signer_receiver-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/transfer_tokens-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2334k ± 0%334k ± 0%~(all equal)
RuntimeTransaction/create_new_account-212.3M ± 0%12.3M ± 0%~(all equal)
RuntimeTransaction/call_empty_contract_function-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/emit_event-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/borrow_array_from_storage-2336k ± 0%336k ± 0%~(all equal)
RuntimeTransaction/copy_array_from_storage-2336k ± 0%336k ± 0%~(all equal)
 
alloc/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-234.7MB ± 3%34.7MB ± 1%~(p=0.628 n=7+6)
RuntimeTransaction/convert_int_to_string-234.9MB ± 2%34.9MB ± 3%~(p=1.000 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-235.6MB ± 4%35.3MB ± 4%~(p=1.000 n=7+7)
RuntimeTransaction/get_signer_address-234.8MB ± 3%35.0MB ± 4%~(p=0.805 n=7+7)
RuntimeTransaction/get_public_account-235.6MB ± 4%36.4MB ± 5%~(p=0.073 n=7+7)
RuntimeTransaction/get_account_and_get_balance-2121MB ± 2%121MB ± 2%~(p=0.456 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-2106MB ± 2%106MB ± 3%~(p=0.710 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-236.4MB ± 3%37.0MB ± 3%~(p=0.259 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-2101MB ± 2%102MB ± 2%~(p=0.318 n=7+7)
RuntimeTransaction/get_signer_vault-237.2MB ± 5%37.0MB ± 3%~(p=0.805 n=7+7)
RuntimeTransaction/get_signer_receiver-240.2MB ± 4%40.2MB ± 5%~(p=0.945 n=6+7)
RuntimeTransaction/transfer_tokens-283.7MB ± 3%84.7MB ± 4%~(p=0.456 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-236.0MB ± 2%35.9MB ± 3%~(p=0.805 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-252.9MB ± 7%52.7MB ± 2%~(p=0.534 n=7+6)
RuntimeTransaction/create_new_account-2180MB ± 2%182MB ± 3%~(p=0.535 n=7+7)
RuntimeTransaction/call_empty_contract_function-235.6MB ± 1%35.3MB ± 3%~(p=0.445 n=6+7)
RuntimeTransaction/emit_event-241.2MB ± 5%40.2MB ± 5%~(p=0.318 n=7+7)
RuntimeTransaction/borrow_array_from_storage-270.0MB ± 5%69.5MB ± 4%~(p=0.535 n=7+7)
RuntimeTransaction/copy_array_from_storage-281.4MB ± 3%80.6MB ± 3%~(p=0.535 n=7+7)
RuntimeNFTBatchTransfer-254.8MB ± 4%55.5MB ± 3%~(p=0.535 n=7+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-21.20GB ± 0%1.20GB ± 1%~(p=1.000 n=7+7)
 
allocs/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/create_new_account-22.27M ± 0%2.27M ± 0%−0.01%(p=0.001 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-21.11M ± 0%1.11M ± 0%−0.02%(p=0.001 n=7+7)
RuntimeTransaction/get_account_and_get_balance-21.30M ± 0%1.30M ± 0%−0.02%(p=0.001 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-21.23M ± 0%1.23M ± 0%−0.02%(p=0.001 n=7+7)
RuntimeTransaction/transfer_tokens-2842k ± 0%842k ± 0%−0.03%(p=0.001 n=7+6)
RuntimeTransaction/borrow_array_from_storage-2336k ± 0%336k ± 0%−0.09%(p=0.001 n=7+7)
RuntimeTransaction/copy_array_from_storage-2293k ± 0%292k ± 0%−0.10%(p=0.001 n=7+7)
RuntimeTransaction/get_signer_receiver-2198k ± 0%197k ± 0%−0.15%(p=0.001 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2194k ± 0%193k ± 0%−0.15%(p=0.001 n=7+7)
RuntimeTransaction/emit_event-2138k ± 0%137k ± 0%−0.21%(p=0.001 n=7+7)
RuntimeTransaction/get_signer_vault-2123k ± 0%123k ± 0%−0.23%(p=0.008 n=5+5)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2122k ± 0%121k ± 0%−0.23%(p=0.001 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-2119k ± 0%119k ± 0%−0.24%(p=0.001 n=7+6)
RuntimeTransaction/get_public_account-2109k ± 0%109k ± 0%−0.26%(p=0.001 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2106k ± 0%106k ± 0%−0.27%(p=0.001 n=7+7)
RuntimeTransaction/call_empty_contract_function-298.3k ± 0%98.0k ± 0%−0.29%(p=0.001 n=7+6)
RuntimeNFTBatchTransfer-2268k ± 0%268k ± 1%−0.30%(p=0.035 n=6+7)
RuntimeTransaction/convert_int_to_string-295.0k ± 0%94.8k ± 0%−0.30%(p=0.001 n=7+7)
RuntimeTransaction/get_signer_address-287.0k ± 0%86.8k ± 0%−0.32%(p=0.001 n=7+6)
RuntimeTransaction/reference_tx-282.8k ± 0%82.6k ± 0%−0.34%(p=0.001 n=7+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-217.2M ± 0%17.2M ± 0%−0.35%(p=0.001 n=7+6)
 
us/txdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-22.14k ± 0%2.13k ± 1%~(p=0.379 n=6+7)
 

@pattyshack
Copy link
Contributor Author

i've tweaked the function signatures a bit, but it's functionally identical.

This is both prep work for flattening transaction execution loops and prep work
for pre-computing / caching txnId for tracing (see #3793)
@pattyshack
Copy link
Contributor Author

bors merge

bors bot added a commit that referenced this pull request Jan 13, 2023
3804: Pre-populate []transactions into collectionItem r=pattyshack a=pattyshack

This is both prep work for flattening transaction execution loops and prep work for pre-computing / caching txnId for tracing (see #3793)

Co-authored-by: Patrick Lee <patrick.lee@dapperlabs.com>
@bors
Copy link
Contributor

bors bot commented Jan 13, 2023

@codecov-commenter
Copy link

Codecov Report

Merging #3804 (0624fc7) into master (2c53333) will increase coverage by 0.01%.
The diff coverage is 92.30%.

@@            Coverage Diff             @@
##           master    #3804      +/-   ##
==========================================
+ Coverage   52.95%   52.96%   +0.01%     
==========================================
  Files         798      798              
  Lines       73680    73708      +28     
==========================================
+ Hits        39015    39038      +23     
- Misses      31490    31493       +3     
- Partials     3175     3177       +2     
Flag Coverage Δ
unittests 52.96% <92.30%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
engine/execution/computation/computer/computer.go 87.07% <92.30%> (+0.46%) ⬆️
engine/access/apiproxy/access_api_proxy.go 15.44% <0.00%> (-1.63%) ⬇️
...sus/approvals/assignment_collector_statemachine.go 47.10% <0.00%> (-1.45%) ⬇️
engine/access/ingestion/engine.go 59.66% <0.00%> (+0.18%) ⬆️
consensus/hotstuff/eventloop/event_loop.go 74.82% <0.00%> (+1.36%) ⬆️
...ratelimit/internal/limiter_map/rate_limiter_map.go 78.66% <0.00%> (+2.66%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pattyshack
Copy link
Contributor Author

bors retry

@bors bors bot merged commit d428872 into master Jan 13, 2023
@bors bors bot deleted the patrick/pre-gen-txn branch January 13, 2023 19:25
This pull request was closed.
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