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

Remove dynamic types #1577

Merged
merged 2 commits into from
Apr 13, 2022
Merged

Remove dynamic types #1577

merged 2 commits into from
Apr 13, 2022

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Apr 12, 2022

Description

  • Remove the DynamicType type hierarchy
  • Remove the interpreter.Value.DynamicType method
  • Refactor DynamicType.IsImportable to Value.IsImportable
    • sema.Type.IsImportable is not a replacement: e.g. a capability is statically always importable, but a specific capability value is only importable iff the domain is public

  • 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 marked this pull request as ready for review April 12, 2022 23:59
@turbolent turbolent requested review from SupunS and dsainati1 April 12, 2022 23:59
@turbolent turbolent force-pushed the bastian/dynamic-type-checking-improvements branch from 3859199 to 1f91960 Compare April 13, 2022 17:05
Base automatically changed from bastian/dynamic-type-checking-improvements to master April 13, 2022 17:25
@turbolent turbolent force-pushed the bastian/remove-dynamic-types branch from e81eac7 to 92622c1 Compare April 13, 2022 17:27
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.

+243 −970 😍

@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@1ef8460). Click here to learn what that means.
The diff coverage is 62.50%.

@@            Coverage Diff            @@
##             master    #1577   +/-   ##
=========================================
  Coverage          ?   74.64%           
=========================================
  Files             ?      288           
  Lines             ?    55364           
  Branches          ?        0           
=========================================
  Hits              ?    41329           
  Misses            ?    12536           
  Partials          ?     1499           
Flag Coverage Δ
unittests 74.64% <62.50%> (?)

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

Impacted Files Coverage Δ
runtime/errors.go 42.00% <ø> (ø)
runtime/interpreter/account.go 92.48% <ø> (ø)
runtime/interpreter/accountcontracts.go 81.13% <ø> (ø)
runtime/interpreter/accountkey.go 100.00% <ø> (ø)
runtime/interpreter/accountkeys.go 77.27% <ø> (ø)
runtime/interpreter/block.go 90.00% <ø> (ø)
runtime/interpreter/deployedcontract.go 100.00% <ø> (ø)
runtime/interpreter/function.go 52.71% <0.00%> (ø)
runtime/interpreter/interpreter.go 88.71% <ø> (ø)
runtime/interpreter/interpreter_tracing.go 90.47% <0.00%> (ø)
... and 7 more

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 1ef8460...92622c1. Read the comment docs.

@github-actions
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 1ef8460
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
NewInterpreter/new_sub-interpreter-22.28µs ± 1%2.31µs ± 0%+1.10%(p=0.001 n=7+7)
NewInterpreter/new_interpreter-21.10µs ± 0%1.11µs ± 1%+1.09%(p=0.011 n=6+6)
RuntimeFungibleTokenTransfer-21.09ms ±33%0.90ms ± 2%~(p=0.534 n=7+6)
RuntimeResourceDictionaryValues-26.08ms ± 2%6.01ms ± 2%~(p=0.097 n=7+7)
Transfer-278.5ns ± 1%78.4ns ± 3%~(p=0.485 n=6+6)
ParseArray-212.0ms ± 1%12.0ms ± 0%~(p=0.628 n=7+6)
ParseInfix-28.80µs ± 6%8.54µs ± 1%~(p=0.710 n=7+7)
ParseDeploy/byte_array-218.8ms ± 2%18.6ms ± 1%~(p=0.073 n=7+6)
ParseDeploy/decode_hex-21.14ms ± 0%1.13ms ± 1%~(p=0.394 n=6+6)
ParseFungibleToken-2181µs ± 1%186µs ± 8%~(p=0.366 n=6+7)
QualifiedIdentifierCreation/One_level-22.46ns ± 5%2.44ns ± 3%~(p=0.727 n=6+6)
QualifiedIdentifierCreation/Three_levels-2119ns ± 0%119ns ± 1%~(p=0.465 n=6+6)
ContractInterfaceFungibleToken-241.2µs ± 8%40.1µs ± 0%~(p=0.836 n=7+6)
CheckContractInterfaceFungibleTokenConformance-2128µs ± 1%131µs ± 4%~(p=0.234 n=6+7)
InterpretRecursionFib-22.85ms ± 3%2.91ms ± 7%~(p=0.620 n=7+7)
 
alloc/opdelta
ContractInterfaceFungibleToken-226.6kB ± 0%26.6kB ± 0%+0.00%(p=0.021 n=7+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)
CheckContractInterfaceFungibleTokenConformance-266.2kB ± 0%66.2kB ± 0%~(p=0.070 n=7+7)
InterpretRecursionFib-21.14MB ± 0%1.14MB ± 0%~(p=0.232 n=7+5)
NewInterpreter/new_interpreter-2848B ± 0%848B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.34kB ± 0%1.34kB ± 0%~(all equal)
RuntimeResourceDictionaryValues-22.25MB ± 0%2.25MB ± 0%−0.02%(p=0.004 n=7+7)
RuntimeFungibleTokenTransfer-2274kB ± 0%273kB ± 0%−0.34%(p=0.003 n=5+7)
 
allocs/opdelta
RuntimeResourceDictionaryValues-237.6k ± 0%37.6k ± 0%~(p=0.883 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)
InterpretRecursionFib-223.8k ± 0%23.8k ± 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)
RuntimeFungibleTokenTransfer-24.59k ± 0%4.58k ± 0%−0.04%(p=0.006 n=7+7)
 

@turbolent turbolent merged commit 78ece6e into master Apr 13, 2022
@turbolent turbolent deleted the bastian/remove-dynamic-types branch April 13, 2022 17:48
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