flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

Internalize state/meter creation

Open pattyshack opened this issue 2 years ago • 2 comments

Also renamed NewStateHolder to NewStateTransaction in preparation for renaming the struct.

pattyshack avatar Aug 15 '22 19:08 pattyshack

FVM Benchstat comparison

This branch with compared with the base branch onflow:master commit b2290e28a76fcc781a119b2e90f672ae8253bde6

The command (for i in {1..10}; 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/convert_int_to_string-237.1ms ± 3%38.7ms ±10%+4.17%(p=0.046 n=8+9)
RuntimeTransaction/load_and_save_long_string_on_signers_address-282.1ms ± 2%83.6ms ± 3%+1.83%(p=0.011 n=10+10)
RuntimeTransaction/get_account_and_get_storage_capacity-2386ms ± 1%390ms ± 1%+1.06%(p=0.009 n=10+8)
RuntimeTransaction/create_new_account-2992ms ± 1%999ms ± 1%+0.70%(p=0.034 n=10+8)
RuntimeTransaction/reference_tx-237.1ms ±18%38.5ms ±17%~(p=0.315 n=10+10)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-238.6ms ± 6%40.4ms ±15%~(p=0.243 n=9+10)
RuntimeTransaction/get_signer_address-236.8ms ±12%36.3ms ± 5%~(p=0.481 n=10+10)
RuntimeTransaction/get_public_account-240.2ms ± 2%39.7ms ± 8%~(p=0.387 n=9+9)
RuntimeTransaction/get_account_and_get_balance-2509ms ± 2%513ms ± 3%~(p=0.143 n=10+10)
RuntimeTransaction/get_account_and_get_available_balance-2416ms ± 2%412ms ± 2%~(p=0.139 n=8+9)
RuntimeTransaction/get_account_and_get_storage_used-244.4ms ± 5%43.7ms ± 7%~(p=0.222 n=9+9)
RuntimeTransaction/get_signer_vault-244.4ms ± 5%45.1ms ± 5%~(p=0.315 n=10+10)
RuntimeTransaction/get_signer_receiver-256.6ms ± 1%56.9ms ± 2%~(p=0.353 n=10+10)
RuntimeTransaction/transfer_tokens-2204ms ± 2%208ms ± 5%~(p=0.113 n=9+10)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-243.5ms ± 2%44.1ms ± 6%~(p=0.274 n=8+10)
RuntimeTransaction/call_empty_contract_function-238.9ms ± 8%39.4ms ± 4%~(p=0.218 n=10+10)
RuntimeTransaction/emit_event-255.4ms ± 3%55.3ms ± 3%~(p=0.853 n=10+10)
RuntimeTransaction/borrow_array_from_storage-2130ms ± 3%129ms ± 5%~(p=0.436 n=10+10)
RuntimeTransaction/copy_array_from_storage-2132ms ± 5%130ms ± 3%~(p=0.218 n=10+10)
RuntimeNFTBatchTransfer-2120ms ± 5%120ms ± 5%~(p=0.965 n=8+10)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/1/cols/16/txes-259.2ms ± 4%58.4ms ± 5%~(p=0.139 n=8+9)
ComputeBlock/1/cols/32/txes-2103ms ± 3%103ms ± 3%~(p=0.661 n=10+9)
ComputeBlock/1/cols/64/txes-2203ms ± 3%202ms ± 2%~(p=0.360 n=10+8)
ComputeBlock/1/cols/128/txes-2399ms ± 1%398ms ± 1%~(p=0.666 n=9+9)
ComputeBlock/4/cols/16/txes-2209ms ± 2%209ms ± 3%~(p=0.497 n=9+10)
ComputeBlock/4/cols/32/txes-2400ms ± 4%403ms ± 3%~(p=0.387 n=9+9)
ComputeBlock/4/cols/64/txes-2771ms ± 2%773ms ± 1%~(p=0.739 n=10+10)
ComputeBlock/4/cols/128/txes-21.51s ± 2%1.51s ± 2%~(p=0.393 n=10+10)
ComputeBlock/16/cols/16/txes-2807ms ± 2%806ms ± 2%~(p=0.853 n=10+10)
ComputeBlock/16/cols/32/txes-21.55s ± 2%1.54s ± 2%~(p=0.353 n=10+10)
ComputeBlock/16/cols/64/txes-23.01s ± 1%2.99s ± 1%~(p=0.095 n=10+9)
ComputeBlock/16/cols/128/txes-25.91s ± 1%5.89s ± 1%~(p=0.353 n=10+10)
 
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-22.60k ± 0%2.60k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-21.30k ± 0%1.30k ± 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-244.4k ± 0%44.4k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string-244.4k ± 0%44.4k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-244.4k ± 0%44.4k ± 0%~(all equal)
RuntimeTransaction/get_signer_address-244.4k ± 0%44.4k ± 0%~(all equal)
RuntimeTransaction/get_public_account-244.4k ± 0%44.4k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_balance-216.8M ± 0%16.8M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_available_balance-25.28M ± 0%5.28M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-248.0k ± 0%48.0k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-25.27M ± 0%5.27M ± 0%~(all equal)
RuntimeTransaction/get_signer_vault-244.7k ± 0%44.7k ± 0%~(all equal)
RuntimeTransaction/get_signer_receiver-245.0k ± 0%45.0k ± 0%~(all equal)
RuntimeTransaction/transfer_tokens-245.8k ± 0%45.8k ± 0%~(all equal)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-244.8k ± 0%44.8k ± 0%~(all equal)
RuntimeTransaction/load_and_save_long_string_on_signers_address-249.7k ± 0%49.7k ± 0%~(all equal)
RuntimeTransaction/create_new_account-28.53M ± 0%8.53M ± 0%~(all equal)
RuntimeTransaction/call_empty_contract_function-244.6k ± 0%44.6k ± 0%~(all equal)
RuntimeTransaction/emit_event-244.6k ± 0%44.6k ± 0%~(all equal)
RuntimeTransaction/borrow_array_from_storage-249.8k ± 0%49.8k ± 0%~(all equal)
RuntimeTransaction/copy_array_from_storage-249.8k ± 0%49.8k ± 0%~(all equal)
 
alloc/opdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/1/cols/64/txes-287.1MB ± 3%89.4MB ± 3%+2.66%(p=0.005 n=10+10)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-237.1MB ± 6%37.2MB ± 6%~(p=0.796 n=10+10)
RuntimeTransaction/convert_int_to_string-237.9MB ± 6%38.6MB ± 3%~(p=0.143 n=10+10)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-237.8MB ± 6%37.6MB ± 6%~(p=0.684 n=10+10)
RuntimeTransaction/get_signer_address-238.1MB ± 6%37.2MB ± 6%~(p=0.165 n=10+10)
RuntimeTransaction/get_public_account-240.5MB ± 3%39.6MB ± 6%~(p=0.243 n=9+10)
RuntimeTransaction/get_account_and_get_balance-2236MB ± 1%236MB ± 1%~(p=0.684 n=10+10)
RuntimeTransaction/get_account_and_get_available_balance-2186MB ± 2%187MB ± 2%~(p=0.529 n=10+10)
RuntimeTransaction/get_account_and_get_storage_used-241.1MB ± 7%39.9MB ± 6%~(p=0.063 n=10+10)
RuntimeTransaction/get_account_and_get_storage_capacity-2182MB ± 0%181MB ± 3%~(p=0.965 n=8+10)
RuntimeTransaction/get_signer_vault-240.4MB ± 7%40.7MB ± 6%~(p=0.684 n=10+10)
RuntimeTransaction/get_signer_receiver-246.2MB ± 3%46.1MB ± 3%~(p=0.912 n=10+10)
RuntimeTransaction/transfer_tokens-284.6MB ± 7%86.4MB ± 3%~(p=0.218 n=10+10)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-239.5MB ± 3%40.1MB ± 8%~(p=0.243 n=9+10)
RuntimeTransaction/load_and_save_long_string_on_signers_address-255.5MB ± 3%56.1MB ± 2%~(p=0.182 n=10+9)
RuntimeTransaction/create_new_account-2260MB ± 2%261MB ± 2%~(p=0.353 n=10+10)
RuntimeTransaction/call_empty_contract_function-238.3MB ± 8%38.6MB ± 7%~(p=0.579 n=10+10)
RuntimeTransaction/emit_event-245.5MB ± 6%45.5MB ± 3%~(p=0.780 n=10+9)
RuntimeTransaction/borrow_array_from_storage-262.6MB ± 5%62.5MB ± 4%~(p=0.912 n=10+10)
RuntimeTransaction/copy_array_from_storage-276.4MB ± 4%77.1MB ± 2%~(p=0.400 n=10+9)
RuntimeNFTBatchTransfer-258.9MB ± 2%58.6MB ± 2%~(p=0.114 n=8+9)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/1/cols/16/txes-245.5MB ± 5%45.4MB ± 3%~(p=0.796 n=10+10)
ComputeBlock/1/cols/32/txes-256.8MB ± 2%57.5MB ± 4%~(p=0.278 n=9+10)
ComputeBlock/4/cols/16/txes-2115MB ± 2%114MB ± 5%~(p=0.218 n=10+10)
ComputeBlock/4/cols/32/txes-2175MB ± 0%176MB ± 2%~(p=0.776 n=6+9)
ComputeBlock/4/cols/64/txes-2280MB ± 2%280MB ± 3%~(p=0.971 n=10+10)
ComputeBlock/4/cols/128/txes-2486MB ± 2%484MB ± 0%~(p=0.447 n=10+9)
ComputeBlock/16/cols/16/txes-2392MB ± 2%391MB ± 2%~(p=0.912 n=10+10)
ComputeBlock/16/cols/32/txes-2601MB ± 3%598MB ± 1%~(p=0.842 n=10+9)
ComputeBlock/16/cols/64/txes-21.02GB ± 2%1.01GB ± 1%~(p=0.393 n=10+10)
ComputeBlock/16/cols/128/txes-21.84GB ± 1%1.83GB ± 0%~(p=0.218 n=10+10)
ComputeBlock/1/cols/128/txes-2148MB ± 0%146MB ± 1%−1.14%(p=0.017 n=9+10)
 
allocs/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_account_and_get_storage_capacity-22.39M ± 0%2.39M ± 0%+0.00%(p=0.023 n=10+9)
RuntimeTransaction/reference_tx-2123k ± 0%123k ± 0%~(p=0.515 n=10+10)
RuntimeTransaction/convert_int_to_string-2137k ± 0%137k ± 0%~(p=0.445 n=10+10)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2151k ± 0%151k ± 0%~(p=0.616 n=10+9)
RuntimeTransaction/get_signer_address-2128k ± 0%128k ± 0%~(p=0.269 n=10+10)
RuntimeTransaction/get_public_account-2159k ± 0%159k ± 0%~(p=0.640 n=10+10)
RuntimeTransaction/get_account_and_get_balance-23.17M ± 0%3.17M ± 0%~(p=0.342 n=8+8)
RuntimeTransaction/get_account_and_get_available_balance-22.55M ± 0%2.55M ± 0%~(p=0.699 n=10+10)
RuntimeTransaction/get_account_and_get_storage_used-2181k ± 0%181k ± 0%~(p=0.224 n=10+10)
RuntimeTransaction/get_signer_vault-2175k ± 0%175k ± 0%~(p=0.752 n=10+10)
RuntimeTransaction/get_signer_receiver-2264k ± 0%264k ± 0%~(p=0.752 n=10+10)
RuntimeTransaction/transfer_tokens-21.03M ± 0%1.03M ± 0%~(p=0.897 n=10+10)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2173k ± 0%173k ± 0%~(p=0.368 n=10+9)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2276k ± 0%276k ± 0%~(p=0.210 n=10+10)
RuntimeTransaction/create_new_account-23.60M ± 0%3.60M ± 0%~(p=0.853 n=10+10)
RuntimeTransaction/call_empty_contract_function-2140k ± 0%140k ± 0%~(p=0.446 n=10+10)
RuntimeTransaction/emit_event-2185k ± 0%185k ± 0%~(p=0.753 n=10+10)
RuntimeTransaction/borrow_array_from_storage-2412k ± 0%412k ± 0%~(p=0.510 n=10+9)
RuntimeTransaction/copy_array_from_storage-2368k ± 0%368k ± 0%~(p=0.868 n=10+10)
RuntimeNFTBatchTransfer-2336k ± 0%335k ± 1%~(p=0.051 n=8+10)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/1/cols/32/txes-2464k ± 0%464k ± 0%~(p=0.529 n=10+10)
ComputeBlock/1/cols/64/txes-2921k ± 0%921k ± 0%~(p=0.853 n=10+10)
ComputeBlock/1/cols/128/txes-21.84M ± 0%1.84M ± 0%~(p=0.829 n=8+10)
ComputeBlock/4/cols/16/txes-2922k ± 0%922k ± 0%~(p=0.811 n=10+10)
ComputeBlock/4/cols/32/txes-21.84M ± 0%1.84M ± 0%~(p=0.739 n=10+10)
ComputeBlock/4/cols/64/txes-23.67M ± 0%3.67M ± 0%~(p=0.469 n=10+10)
ComputeBlock/4/cols/128/txes-27.32M ± 0%7.32M ± 0%~(p=0.842 n=9+10)
ComputeBlock/16/cols/16/txes-23.67M ± 0%3.67M ± 0%~(p=0.063 n=10+10)
ComputeBlock/16/cols/32/txes-27.33M ± 0%7.33M ± 0%~(p=0.095 n=9+10)
ComputeBlock/16/cols/64/txes-214.6M ± 0%14.6M ± 0%~(p=0.780 n=9+10)
ComputeBlock/16/cols/128/txes-229.3M ± 0%29.3M ± 0%~(p=0.481 n=10+10)
ComputeBlock/1/cols/16/txes-2235k ± 0%235k ± 0%−0.02%(p=0.027 n=10+10)
 
us/txdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/1/cols/16/txes-23.70k ± 4%3.65k ± 5%~(p=0.132 n=8+9)
ComputeBlock/1/cols/32/txes-23.22k ± 3%3.23k ± 3%~(p=0.619 n=10+9)
ComputeBlock/1/cols/64/txes-23.17k ± 3%3.16k ± 2%~(p=0.395 n=10+8)
ComputeBlock/1/cols/128/txes-23.11k ± 1%3.11k ± 1%~(p=0.666 n=9+9)
ComputeBlock/4/cols/16/txes-23.27k ± 2%3.26k ± 3%~(p=0.497 n=9+10)
ComputeBlock/4/cols/32/txes-23.13k ± 4%3.15k ± 3%~(p=0.387 n=9+9)
ComputeBlock/4/cols/64/txes-23.01k ± 2%3.02k ± 1%~(p=0.725 n=10+10)
ComputeBlock/4/cols/128/txes-22.96k ± 2%2.94k ± 2%~(p=0.382 n=10+10)
ComputeBlock/16/cols/16/txes-23.15k ± 2%3.15k ± 2%~(p=0.870 n=10+10)
ComputeBlock/16/cols/32/txes-23.02k ± 2%3.01k ± 2%~(p=0.342 n=10+10)
ComputeBlock/16/cols/64/txes-22.94k ± 1%2.92k ± 1%~(p=0.090 n=10+9)
ComputeBlock/16/cols/128/txes-22.89k ± 1%2.88k ± 1%~(p=0.324 n=10+10)
 

github-actions[bot] avatar Aug 15 '22 19:08 github-actions[bot]

Codecov Report

Merging #2981 (e9b50be) into master (37b2da7) will decrease coverage by 0.00%. The diff coverage is 80.25%.

@@            Coverage Diff             @@
##           master    #2981      +/-   ##
==========================================
- Coverage   54.66%   54.65%   -0.01%     
==========================================
  Files         711      711              
  Lines       66147    66173      +26     
==========================================
+ Hits        36160    36169       +9     
- Misses      27006    27021      +15     
- Partials     2981     2983       +2     
Flag Coverage Δ
unittests 54.65% <80.25%> (-0.01%) :arrow_down:

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

Impacted Files Coverage Δ
cmd/util/ledger/reporters/account_reporter.go 0.00% <0.00%> (ø)
utils/unittest/unittest.go 5.06% <ø> (ø)
insecure/corruptible/network.go 66.66% <54.54%> (-1.18%) :arrow_down:
fvm/state/state.go 67.61% <89.74%> (-1.47%) :arrow_down:
insecure/attacknetwork/attackNetwork.go 67.22% <93.75%> (+1.13%) :arrow_up:
...md/util/ledger/reporters/fungible_token_tracker.go 89.90% <100.00%> (-0.19%) :arrow_down:
fvm/fvm.go 95.00% <100.00%> (+0.17%) :arrow_up:
fvm/state/state_holder.go 24.52% <100.00%> (+1.45%) :arrow_up:
...ure/attacknetwork/mockCorruptibleConduitFactory.go 80.59% <100.00%> (ø)
insecure/corruptible/network_test_helpers.go 97.53% <100.00%> (+0.03%) :arrow_up:
... and 6 more

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

codecov-commenter avatar Aug 15 '22 20:08 codecov-commenter

bors merge

pattyshack avatar Aug 17 '22 21:08 pattyshack

Merge conflict.

bors[bot] avatar Aug 18 '22 00:08 bors[bot]

bors merge

pattyshack avatar Aug 19 '22 16:08 pattyshack

Build failed:

bors[bot] avatar Aug 19 '22 17:08 bors[bot]

bors merge

pattyshack avatar Aug 19 '22 17:08 pattyshack

Build failed (retrying...):

bors[bot] avatar Aug 19 '22 18:08 bors[bot]