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

Improve new static type-based dynamic type checking #1576

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Apr 12, 2022

Depends on #1487

Description

  • Improve naming, distinguish reference type's borrowed type from referenced type ("inner" type)
  • The borrowed type should never be nil
  • Fix typos

  • 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

@turbolent turbolent self-assigned this Apr 12, 2022
Base automatically changed from supun/dynamic-type-checking to master April 13, 2022 17:04
@turbolent turbolent force-pushed the bastian/dynamic-type-checking-improvements branch from 3859199 to 1f91960 Compare April 13, 2022 17:05
@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

Merging #1576 (1f91960) into master (01ef531) will increase coverage by 0.00%.
The diff coverage is 89.74%.

@@           Coverage Diff           @@
##           master    #1576   +/-   ##
=======================================
  Coverage   74.40%   74.40%           
=======================================
  Files         289      289           
  Lines       55679    55671    -8     
=======================================
- Hits        41427    41423    -4     
+ Misses      12755    12752    -3     
+ Partials     1497     1496    -1     
Flag Coverage Δ
unittests 74.40% <89.74%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
runtime/interpreter/value.go 63.69% <71.42%> (-0.03%) ⬇️
runtime/convertTypes.go 76.64% <100.00%> (ø)
runtime/interpreter/decode.go 46.35% <100.00%> (ø)
runtime/interpreter/encode.go 67.47% <100.00%> (ø)
runtime/interpreter/interpreter.go 83.71% <100.00%> (ø)
runtime/interpreter/statictype.go 73.85% <100.00%> (+0.98%) ⬆️
runtime/interpreter/primitivestatictype.go 79.81% <0.00%> (+0.45%) ⬆️

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 01ef531...1f91960. Read the comment docs.

Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

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

Nice!

@github-actions
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 01ef531
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-26.35ms ± 3%6.38ms ± 3%~(p=0.535 n=7+7)
RuntimeFungibleTokenTransfer-21.09ms ±29%1.20ms ±22%~(p=0.710 n=7+7)
ParseDeploy/byte_array-219.9ms ± 1%20.1ms ± 2%~(p=0.128 n=7+7)
ParseDeploy/decode_hex-21.15ms ± 1%1.15ms ± 1%~(p=0.805 n=7+7)
ParseInfix-28.33µs ± 1%8.34µs ± 1%~(p=0.833 n=7+7)
ParseArray-212.4ms ± 2%12.5ms ± 2%~(p=0.259 n=7+7)
ParseFungibleToken-2181µs ± 1%181µs ± 1%~(p=0.945 n=6+7)
QualifiedIdentifierCreation/One_level-22.34ns ± 0%2.34ns ± 0%~(p=0.965 n=6+6)
QualifiedIdentifierCreation/Three_levels-2138ns ± 0%138ns ± 0%~(p=0.927 n=7+6)
ContractInterfaceFungibleToken-238.9µs ± 1%39.0µs ± 1%~(p=0.644 n=7+7)
CheckContractInterfaceFungibleTokenConformance-2130µs ± 2%131µs ± 1%~(p=0.456 n=7+7)
NewInterpreter/new_interpreter-21.12µs ± 0%1.11µs ± 0%~(p=0.220 n=6+7)
NewInterpreter/new_sub-interpreter-22.19µs ± 0%2.19µs ± 0%~(p=0.346 n=7+6)
InterpretRecursionFib-22.68ms ± 0%2.67ms ± 2%~(p=0.628 n=6+7)
Transfer-282.6ns ± 1%81.6ns ± 1%−1.27%(p=0.004 n=6+6)
 
alloc/opdelta
RuntimeResourceDictionaryValues-22.25MB ± 0%2.25MB ± 0%~(p=0.477 n=7+7)
RuntimeFungibleTokenTransfer-2274kB ± 0%274kB ± 0%~(p=0.383 n=6+7)
Transfer-248.0B ± 0%48.0B ± 0%~(all equal)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
ContractInterfaceFungibleToken-226.6kB ± 0%26.6kB ± 0%~(all equal)
CheckContractInterfaceFungibleTokenConformance-266.2kB ± 0%66.2kB ± 0%~(all equal)
NewInterpreter/new_interpreter-2848B ± 0%848B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.34kB ± 0%1.34kB ± 0%~(all equal)
InterpretRecursionFib-21.14MB ± 0%1.14MB ± 0%~(p=0.592 n=7+7)
 
allocs/opdelta
RuntimeResourceDictionaryValues-237.6k ± 0%37.6k ± 0%~(p=1.000 n=7+7)
RuntimeFungibleTokenTransfer-24.58k ± 0%4.58k ± 0%~(p=0.674 n=7+7)
Transfer-21.00 ± 0%1.00 ± 0%~(all equal)
QualifiedIdentifierCreation/One_level-20.00 0.00 ~(all equal)
QualifiedIdentifierCreation/Three_levels-22.00 ± 0%2.00 ± 0%~(all equal)
ContractInterfaceFungibleToken-2458 ± 0%458 ± 0%~(all equal)
CheckContractInterfaceFungibleTokenConformance-21.07k ± 0%1.07k ± 0%~(all equal)
NewInterpreter/new_interpreter-213.0 ± 0%13.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-240.0 ± 0%40.0 ± 0%~(all equal)
InterpretRecursionFib-223.8k ± 0%23.8k ± 0%~(all equal)
 

@turbolent turbolent merged commit 1ef8460 into master Apr 13, 2022
@turbolent turbolent deleted the bastian/dynamic-type-checking-improvements branch April 13, 2022 17:25
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.

2 participants