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

Refactor environment meter into separate objects

Open pattyshack opened this issue 2 years ago • 2 comments

pattyshack avatar Aug 17 '22 00:08 pattyshack

Codecov Report

Merging #2999 (bbba2d0) into master (1278324) will decrease coverage by 0.02%. The diff coverage is 92.10%.

@@            Coverage Diff             @@
##           master    #2999      +/-   ##
==========================================
- Coverage   54.67%   54.64%   -0.03%     
==========================================
  Files         712      712              
  Lines       66465    66426      -39     
==========================================
- Hits        36338    36301      -37     
+ Misses      27085    27083       -2     
  Partials     3042     3042              
Flag Coverage Δ
unittests 54.64% <92.10%> (-0.03%) :arrow_down:

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

Impacted Files Coverage Δ
fvm/state/state.go 68.00% <0.00%> (ø)
fvm/state/state_holder.go 24.00% <0.00%> (ø)
fvm/env.go 60.45% <95.23%> (-1.08%) :arrow_down:
fvm/meter/weighted_meter.go 82.07% <100.00%> (ø)
fvm/scriptEnv.go 76.92% <100.00%> (+3.88%) :arrow_up:
fvm/transactionEnv.go 79.93% <100.00%> (-0.27%) :arrow_down:
fvm/transactionInvoker.go 75.22% <100.00%> (ø)
...s/hotstuff/votecollector/staking_vote_processor.go 80.64% <0.00%> (-3.23%) :arrow_down:
module/profiler/profiler.go 77.88% <0.00%> (-1.93%) :arrow_down:
consensus/hotstuff/eventloop/event_loop.go 73.46% <0.00%> (-1.37%) :arrow_down:
... and 2 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 17 '22 01:08 codecov-commenter

FVM Benchstat comparison

This branch with compared with the base branch onflow:master commit 7401a03f031763cd1070ef9902d28b2c426b618d

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/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/4/cols/16/txes-2305ms ± 2%315ms ± 4%+3.24%(p=0.001 n=9+10)
ComputeBlock/1/cols/128/txes-2583ms ± 3%597ms ± 3%+2.34%(p=0.009 n=10+10)
ComputeBlock/16/cols/128/txes-28.64s ± 2%8.84s ± 4%+2.34%(p=0.008 n=9+10)
ComputeBlock/4/cols/64/txes-21.13s ± 1%1.15s ± 3%+2.09%(p=0.029 n=10+10)
ComputeBlock/16/cols/64/txes-24.41s ± 2%4.49s ± 3%+1.83%(p=0.029 n=10+10)
ComputeBlock/16/cols/32/txes-22.26s ± 2%2.30s ± 3%+1.70%(p=0.028 n=9+10)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-252.0ms ±10%53.0ms ±14%~(p=0.905 n=9+10)
RuntimeTransaction/convert_int_to_string-256.6ms ±13%53.7ms ± 6%~(p=0.114 n=9+8)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-259.1ms ± 8%57.4ms ± 4%~(p=0.094 n=9+9)
RuntimeTransaction/get_signer_address-253.5ms ±11%54.4ms ± 5%~(p=0.280 n=10+10)
RuntimeTransaction/get_public_account-261.4ms ±14%59.1ms ± 8%~(p=0.190 n=10+10)
RuntimeTransaction/get_account_and_get_balance-2857ms ± 5%851ms ± 3%~(p=0.631 n=10+10)
RuntimeTransaction/get_account_and_get_available_balance-2711ms ± 5%699ms ± 5%~(p=0.280 n=10+10)
RuntimeTransaction/get_account_and_get_storage_used-264.5ms ± 4%64.4ms ± 5%~(p=1.000 n=9+9)
RuntimeTransaction/get_account_and_get_storage_capacity-2649ms ± 3%657ms ± 3%~(p=0.247 n=10+10)
RuntimeTransaction/get_signer_vault-264.4ms ± 3%64.7ms ± 4%~(p=0.971 n=10+10)
RuntimeTransaction/get_signer_receiver-284.6ms ± 3%84.2ms ± 6%~(p=0.853 n=10+10)
RuntimeTransaction/transfer_tokens-2331ms ± 5%323ms ± 3%~(p=0.089 n=10+10)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-263.5ms ± 6%62.0ms ± 8%~(p=0.165 n=10+10)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2113ms ± 7%111ms ± 4%~(p=0.143 n=10+10)
RuntimeTransaction/create_new_account-21.32s ± 5%1.31s ± 2%~(p=0.796 n=10+10)
RuntimeTransaction/call_empty_contract_function-257.7ms ± 2%57.7ms ± 9%~(p=0.631 n=10+10)
RuntimeTransaction/emit_event-277.1ms ± 4%77.0ms ± 3%~(p=0.971 n=10+10)
RuntimeTransaction/borrow_array_from_storage-2179ms ± 4%177ms ± 5%~(p=0.481 n=10+10)
RuntimeTransaction/copy_array_from_storage-2182ms ± 5%183ms ± 5%~(p=0.481 n=10+10)
RuntimeNFTBatchTransfer-2153ms ± 2%153ms ± 3%~(p=0.673 n=9+8)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/1/cols/16/txes-286.1ms ± 4%87.0ms ± 4%~(p=0.353 n=10+10)
ComputeBlock/1/cols/32/txes-2151ms ± 4%152ms ± 3%~(p=0.661 n=10+9)
ComputeBlock/1/cols/64/txes-2296ms ± 4%299ms ± 4%~(p=0.393 n=10+10)
ComputeBlock/4/cols/32/txes-2584ms ± 4%593ms ± 4%~(p=0.218 n=10+10)
ComputeBlock/4/cols/128/txes-22.23s ± 3%2.27s ± 3%~(p=0.089 n=10+10)
ComputeBlock/16/cols/16/txes-21.17s ± 2%1.19s ± 5%~(p=0.190 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/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-236.8MB ± 5%37.0MB ± 5%~(p=0.971 n=10+10)
RuntimeTransaction/convert_int_to_string-238.2MB ± 7%37.8MB ± 8%~(p=0.631 n=10+10)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-239.7MB ± 4%39.6MB ± 6%~(p=0.968 n=9+10)
RuntimeTransaction/get_signer_address-237.2MB ± 6%38.2MB ± 5%~(p=0.105 n=10+10)
RuntimeTransaction/get_public_account-240.3MB ± 5%40.9MB ± 5%~(p=0.529 n=10+10)
RuntimeTransaction/get_account_and_get_available_balance-2185MB ± 3%186MB ± 4%~(p=0.123 n=10+10)
RuntimeTransaction/get_account_and_get_storage_used-241.3MB ± 6%41.0MB ± 6%~(p=0.912 n=10+10)
RuntimeTransaction/get_account_and_get_storage_capacity-2181MB ± 2%182MB ± 0%~(p=0.696 n=10+8)
RuntimeTransaction/get_signer_vault-240.2MB ± 5%40.3MB ± 7%~(p=0.739 n=10+10)
RuntimeTransaction/get_signer_receiver-246.0MB ± 4%45.5MB ± 6%~(p=0.579 n=10+10)
RuntimeTransaction/transfer_tokens-285.6MB ±10%85.4MB ± 3%~(p=0.604 n=10+9)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-240.9MB ± 2%39.7MB ± 7%~(p=0.146 n=8+10)
RuntimeTransaction/load_and_save_long_string_on_signers_address-255.1MB ± 4%55.4MB ± 5%~(p=0.579 n=10+10)
RuntimeTransaction/create_new_account-2256MB ± 2%257MB ± 2%~(p=0.796 n=10+10)
RuntimeTransaction/call_empty_contract_function-239.0MB ± 5%39.2MB ± 9%~(p=0.631 n=10+10)
RuntimeTransaction/emit_event-245.5MB ± 6%46.0MB ± 5%~(p=0.684 n=10+10)
RuntimeTransaction/borrow_array_from_storage-262.1MB ± 4%62.3MB ± 3%~(p=0.971 n=10+10)
RuntimeTransaction/copy_array_from_storage-274.3MB ± 4%75.9MB ± 8%~(p=0.165 n=10+10)
RuntimeNFTBatchTransfer-257.2MB ± 3%57.1MB ± 3%~(p=1.000 n=10+10)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/1/cols/16/txes-245.8MB ± 4%46.2MB ± 4%~(p=0.278 n=9+10)
ComputeBlock/1/cols/32/txes-257.4MB ± 4%56.6MB ± 3%~(p=0.278 n=10+9)
ComputeBlock/1/cols/64/txes-288.4MB ± 5%89.0MB ± 4%~(p=0.684 n=10+10)
ComputeBlock/1/cols/128/txes-2148MB ± 0%148MB ± 0%~(p=0.387 n=9+9)
ComputeBlock/4/cols/16/txes-2115MB ± 4%116MB ± 3%~(p=0.218 n=10+10)
ComputeBlock/4/cols/32/txes-2173MB ± 1%174MB ± 2%~(p=0.631 n=10+10)
ComputeBlock/4/cols/64/txes-2278MB ± 0%282MB ± 2%~(p=0.113 n=9+10)
ComputeBlock/4/cols/128/txes-2487MB ± 3%484MB ± 0%~(p=0.897 n=10+8)
ComputeBlock/16/cols/32/txes-2600MB ± 2%595MB ± 2%~(p=0.079 n=10+9)
ComputeBlock/16/cols/64/txes-21.01GB ± 2%1.01GB ± 1%~(p=0.156 n=9+10)
ComputeBlock/16/cols/128/txes-21.84GB ± 0%1.84GB ± 0%~(p=0.122 n=8+10)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_account_and_get_balance-2237MB ± 0%237MB ± 0%−0.04%(p=0.046 n=9+8)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/16/txes-2393MB ± 3%386MB ± 0%−1.71%(p=0.004 n=10+8)
 
allocs/opdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/32/txes-27.33M ± 0%7.33M ± 0%+0.04%(p=0.002 n=9+10)
ComputeBlock/4/cols/128/txes-27.32M ± 0%7.32M ± 0%+0.03%(p=0.000 n=9+7)
ComputeBlock/4/cols/64/txes-23.66M ± 0%3.67M ± 0%+0.02%(p=0.009 n=10+10)
ComputeBlock/16/cols/16/txes-23.67M ± 0%3.67M ± 0%+0.02%(p=0.035 n=10+10)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_signer_address-2128k ± 0%128k ± 0%+0.02%(p=0.000 n=10+10)
RuntimeTransaction/reference_tx-2123k ± 0%123k ± 0%+0.02%(p=0.000 n=9+10)
RuntimeTransaction/get_account_and_get_storage_used-2181k ± 0%181k ± 0%+0.01%(p=0.000 n=10+10)
RuntimeTransaction/convert_int_to_string-2137k ± 0%137k ± 0%+0.01%(p=0.000 n=10+10)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2151k ± 0%151k ± 0%+0.01%(p=0.000 n=10+10)
RuntimeTransaction/get_public_account-2159k ± 0%159k ± 0%+0.01%(p=0.000 n=9+10)
RuntimeTransaction/get_signer_vault-2175k ± 0%175k ± 0%+0.01%(p=0.000 n=10+10)
RuntimeTransaction/call_empty_contract_function-2140k ± 0%140k ± 0%+0.01%(p=0.000 n=9+10)
RuntimeTransaction/emit_event-2185k ± 0%185k ± 0%+0.01%(p=0.026 n=10+9)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2173k ± 0%173k ± 0%+0.01%(p=0.000 n=10+9)
RuntimeTransaction/copy_array_from_storage-2368k ± 0%368k ± 0%+0.01%(p=0.000 n=10+10)
RuntimeTransaction/borrow_array_from_storage-2412k ± 0%412k ± 0%+0.01%(p=0.000 n=10+9)
RuntimeTransaction/get_signer_receiver-2264k ± 0%264k ± 0%+0.00%(p=0.005 n=10+10)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2276k ± 0%276k ± 0%+0.00%(p=0.001 n=9+9)
RuntimeTransaction/transfer_tokens-21.03M ± 0%1.03M ± 0%+0.00%(p=0.028 n=8+10)
RuntimeTransaction/get_account_and_get_balance-23.17M ± 0%3.17M ± 0%~(p=0.436 n=10+10)
RuntimeTransaction/get_account_and_get_available_balance-22.55M ± 0%2.55M ± 0%~(p=0.315 n=10+10)
RuntimeTransaction/get_account_and_get_storage_capacity-22.39M ± 0%2.39M ± 0%~(p=0.810 n=10+10)
RuntimeTransaction/create_new_account-23.59M ± 0%3.59M ± 0%~(p=0.393 n=10+10)
RuntimeNFTBatchTransfer-2330k ± 1%330k ± 1%~(p=0.954 n=10+10)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/1/cols/16/txes-2235k ± 0%235k ± 0%~(p=0.051 n=10+10)
ComputeBlock/1/cols/32/txes-2464k ± 0%464k ± 0%~(p=0.149 n=10+10)
ComputeBlock/1/cols/64/txes-2921k ± 0%921k ± 0%~(p=0.190 n=10+10)
ComputeBlock/1/cols/128/txes-21.84M ± 0%1.84M ± 0%~(p=0.968 n=10+9)
ComputeBlock/4/cols/16/txes-2922k ± 0%922k ± 0%~(p=0.393 n=10+10)
ComputeBlock/4/cols/32/txes-21.84M ± 0%1.84M ± 0%~(p=0.075 n=10+10)
ComputeBlock/16/cols/64/txes-214.6M ± 0%14.6M ± 0%~(p=0.497 n=10+9)
ComputeBlock/16/cols/128/txes-229.3M ± 0%29.3M ± 0%~(p=0.280 n=10+10)
 
us/txdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/4/cols/16/txes-24.77k ± 2%4.92k ± 4%+3.24%(p=0.001 n=9+10)
ComputeBlock/1/cols/128/txes-24.55k ± 3%4.66k ± 3%+2.35%(p=0.009 n=10+10)
ComputeBlock/16/cols/128/txes-24.22k ± 2%4.32k ± 4%+2.34%(p=0.007 n=9+10)
ComputeBlock/4/cols/64/txes-24.41k ± 1%4.50k ± 3%+2.09%(p=0.029 n=10+10)
ComputeBlock/16/cols/64/txes-24.31k ± 2%4.39k ± 3%+1.84%(p=0.029 n=10+10)
ComputeBlock/16/cols/32/txes-24.42k ± 2%4.49k ± 3%+1.70%(p=0.028 n=9+10)
ComputeBlock/1/cols/16/txes-25.38k ± 4%5.44k ± 4%~(p=0.363 n=10+10)
ComputeBlock/1/cols/32/txes-24.73k ± 4%4.75k ± 3%~(p=0.661 n=10+9)
ComputeBlock/1/cols/64/txes-24.62k ± 4%4.68k ± 4%~(p=0.363 n=10+10)
ComputeBlock/4/cols/32/txes-24.56k ± 4%4.63k ± 4%~(p=0.218 n=10+10)
ComputeBlock/4/cols/128/txes-24.35k ± 3%4.43k ± 3%~(p=0.078 n=10+10)
ComputeBlock/16/cols/16/txes-24.58k ± 2%4.64k ± 5%~(p=0.190 n=10+10)
 

github-actions[bot] avatar Aug 17 '22 01:08 github-actions[bot]

bors merge

pattyshack avatar Aug 19 '22 15:08 pattyshack