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

Ignore dead code #1345

Merged
merged 1 commit into from
Jan 10, 2022
Merged

Ignore dead code #1345

merged 1 commit into from
Jan 10, 2022

Conversation

turbolent
Copy link
Member

Description

Don't just report, but also ignore dead code. This reduces checking time, and actually has the side-effect of improving errors: Checking dead code was poisoning the data flow analysis (a function activation's return info tracks if the function definitely returned/jumped/halted), so e.g. a missing return statement error was not reported.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@codecov-commenter
Copy link

Codecov Report

Merging #1345 (0002edd) into master (b07c80c) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1345      +/-   ##
==========================================
- Coverage   75.70%   75.70%   -0.01%     
==========================================
  Files         280      280              
  Lines       38585    38584       -1     
==========================================
- Hits        29211    29210       -1     
  Misses       8028     8028              
  Partials     1346     1346              
Flag Coverage Δ
unittests 75.70% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
runtime/sema/function_activations.go 93.93% <ø> (ø)
runtime/sema/check_block.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b07c80c...0002edd. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jan 7, 2022

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit b07c80c
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Results

old.txtnew.txt
time/opdelta
RuntimeResourceDictionaryValues-215.0ms ± 5%14.7ms ± 1%~(p=0.318 n=7+7)
RuntimeFungibleTokenTransfer-21.20ms ±35%1.31ms ±25%~(p=1.000 n=7+7)
ParseInfix-29.93µs ± 5%9.67µs ± 1%~(p=0.053 n=7+7)
ParseDeploy/byte_array-222.6ms ± 6%22.6ms ± 9%~(p=0.805 n=7+7)
ParseDeploy/decode_hex-21.17ms ± 2%1.17ms ± 0%~(p=0.366 n=7+6)
QualifiedIdentifierCreation/One_level-22.68ns ± 0%2.68ns ± 0%~(p=0.793 n=7+7)
QualifiedIdentifierCreation/Three_levels-2141ns ± 4%140ns ± 2%~(p=0.734 n=7+7)
ContractInterfaceFungibleToken-240.3µs ± 3%40.0µs ± 2%~(p=0.310 n=6+6)
CheckContractInterfaceFungibleTokenConformance-2135µs ± 4%132µs ± 2%~(p=0.181 n=7+6)
NewInterpreter/new_interpreter-21.02µs ± 1%1.02µs ± 1%~(p=0.589 n=6+6)
NewInterpreter/new_sub-interpreter-22.03µs ± 2%2.03µs ± 1%~(p=0.805 n=7+6)
InterpretRecursionFib-22.47ms ± 3%2.44ms ± 2%~(p=0.073 n=7+7)
ParseFungibleToken-2186µs ± 3%181µs ± 1%−2.40%(p=0.002 n=7+6)
ParseArray-214.1ms ± 5%13.3ms ± 2%−6.29%(p=0.004 n=6+6)
 
alloc/opdelta
RuntimeResourceDictionaryValues-24.05MB ± 0%4.05MB ± 0%~(p=0.805 n=7+7)
RuntimeFungibleTokenTransfer-2273kB ± 0%273kB ± 0%~(p=0.477 n=7+7)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
CheckContractInterfaceFungibleTokenConformance-265.7kB ± 0%65.7kB ± 0%~(p=0.462 n=7+7)
NewInterpreter/new_interpreter-2720B ± 0%720B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.18kB ± 0%1.18kB ± 0%~(all equal)
InterpretRecursionFib-21.24MB ± 0%1.24MB ± 0%~(p=0.538 n=7+6)
ContractInterfaceFungibleToken-226.5kB ± 0%26.5kB ± 0%−0.00%(p=0.042 n=7+6)
 
allocs/opdelta
RuntimeResourceDictionaryValues-2102k ± 0%102k ± 0%~(p=0.685 n=7+7)
RuntimeFungibleTokenTransfer-24.54k ± 0%4.54k ± 0%~(p=0.499 n=7+7)
QualifiedIdentifierCreation/One_level-20.00 0.00 ~(all equal)
QualifiedIdentifierCreation/Three_levels-22.00 ± 0%2.00 ± 0%~(all equal)
ContractInterfaceFungibleToken-2457 ± 0%457 ± 0%~(all equal)
CheckContractInterfaceFungibleTokenConformance-21.07k ± 0%1.07k ± 0%~(all equal)
NewInterpreter/new_interpreter-211.0 ± 0%11.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-236.0 ± 0%36.0 ± 0%~(all equal)
InterpretRecursionFib-225.0k ± 0%25.0k ± 0%~(all equal)
 

@turbolent turbolent merged commit b180983 into master Jan 10, 2022
@turbolent turbolent deleted the bastian/ignore-dead-code branch January 10, 2022 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants