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 sema #2166

Merged
merged 2 commits into from
Nov 28, 2022
Merged

Improve sema #2166

merged 2 commits into from
Nov 28, 2022

Conversation

turbolent
Copy link
Member

Description

Add type assertions and make naming for field and function name constants consistent.


  • 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 requested a review from a team November 25, 2022 21:43
@turbolent turbolent self-assigned this Nov 25, 2022
@codecov
Copy link

codecov bot commented Nov 25, 2022

Codecov Report

Merging #2166 (1d30a85) into master (e2f0bc5) will increase coverage by 0.01%.
The diff coverage is 99.21%.

@@            Coverage Diff             @@
##           master    #2166      +/-   ##
==========================================
+ Coverage   77.68%   77.69%   +0.01%     
==========================================
  Files         308      308              
  Lines       64246    64302      +56     
==========================================
+ Hits        49910    49961      +51     
- Misses      12600    12605       +5     
  Partials     1736     1736              
Flag Coverage Δ
unittests 77.69% <99.21%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
runtime/sema/simple_type.go 96.15% <ø> (ø)
runtime/stdlib/test.go 38.19% <0.00%> (ø)
runtime/convertValues.go 83.00% <100.00%> (ø)
runtime/interpreter/account.go 92.66% <100.00%> (ø)
runtime/interpreter/accountinbox.go 73.07% <100.00%> (ø)
runtime/interpreter/accountkey.go 100.00% <100.00%> (ø)
runtime/interpreter/accountkeys.go 74.19% <100.00%> (ø)
runtime/interpreter/value.go 68.96% <100.00%> (ø)
runtime/interpreter/value_publickey.go 100.00% <100.00%> (ø)
runtime/sema/authaccount_type.go 100.00% <100.00%> (ø)
... and 7 more

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

@github-actions
Copy link

Cadence Benchstat comparison

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

Collapsed results for better readability

old.txtnew.txt
time/opdelta
CheckContractInterfaceFungibleTokenConformance-2115µs ± 2%114µs ± 1%~(p=0.534 n=7+6)
ContractInterfaceFungibleToken-239.0µs ± 1%38.8µs ± 1%~(p=0.620 n=7+7)
InterpretRecursionFib-22.36ms ± 1%2.37ms ± 2%~(p=0.731 n=6+7)
NewInterpreter/new_interpreter-21.11µs ± 1%1.11µs ± 0%~(p=1.000 n=6+6)
NewInterpreter/new_sub-interpreter-2598ns ± 2%598ns ± 2%~(p=1.000 n=7+6)
ParseArray-27.96ms ± 1%8.02ms ± 2%~(p=0.132 n=6+6)
ParseDeploy/byte_array-212.2ms ± 4%12.1ms ± 4%~(p=0.805 n=7+7)
ParseDeploy/decode_hex-21.22ms ± 3%1.21ms ± 1%~(p=0.445 n=7+6)
ParseFungibleToken/With_memory_metering-2187µs ± 1%187µs ± 3%~(p=0.620 n=7+7)
ParseFungibleToken/Without_memory_metering-2147µs ± 3%147µs ± 1%~(p=1.000 n=7+7)
ParseInfix-26.95µs ± 3%6.90µs ± 1%~(p=0.945 n=7+6)
QualifiedIdentifierCreation/One_level-22.35ns ± 0%2.35ns ± 1%~(p=0.775 n=6+7)
QualifiedIdentifierCreation/Three_levels-2136ns ± 1%135ns ± 1%~(p=0.731 n=7+7)
RuntimeFungibleTokenTransfer-2618µs ±24%668µs ±24%~(p=0.710 n=7+7)
RuntimeResourceDictionaryValues-25.21ms ± 1%5.20ms ± 3%~(p=0.366 n=6+7)
RuntimeScriptNoop-217.9µs ±43%20.8µs ±30%~(p=0.805 n=7+7)
SuperTypeInference/arrays-2313ns ± 3%309ns ± 1%~(p=0.214 n=7+6)
SuperTypeInference/composites-2131ns ± 0%131ns ± 0%~(p=0.796 n=7+6)
SuperTypeInference/integers-289.6ns ± 0%89.6ns ± 0%~(p=0.628 n=7+6)
ValueIsSubtypeOfSemaType-291.9ns ± 2%91.4ns ± 0%~(p=0.639 n=7+5)
 
alloc/opdelta
CheckContractInterfaceFungibleTokenConformance-249.7kB ± 0%49.7kB ± 0%~(all equal)
ContractInterfaceFungibleToken-224.0kB ± 0%24.0kB ± 0%~(all equal)
InterpretRecursionFib-21.00MB ± 0%1.00MB ± 0%~(all equal)
NewInterpreter/new_interpreter-2752B ± 0%752B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-2200B ± 0%200B ± 0%~(all equal)
ParseArray-22.72MB ± 3%2.74MB ± 3%~(p=0.383 n=7+7)
ParseDeploy/byte_array-24.14MB ± 3%4.14MB ± 3%~(p=0.902 n=7+7)
ParseDeploy/decode_hex-2214kB ± 0%214kB ± 0%~(p=0.777 n=7+7)
ParseFungibleToken/With_memory_metering-229.2kB ± 0%29.2kB ± 0%~(p=0.145 n=7+7)
ParseFungibleToken/Without_memory_metering-229.2kB ± 0%29.2kB ± 0%~(p=0.262 n=7+7)
ParseInfix-21.91kB ± 0%1.92kB ± 0%~(p=0.867 n=7+7)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
RuntimeFungibleTokenTransfer-2102kB ± 1%103kB ± 1%~(p=0.535 n=7+7)
RuntimeResourceDictionaryValues-22.28MB ± 0%2.28MB ± 0%~(p=0.710 n=7+7)
RuntimeScriptNoop-28.44kB ± 0%8.44kB ± 0%~(p=0.171 n=7+7)
SuperTypeInference/arrays-296.0B ± 0%96.0B ± 0%~(all equal)
SuperTypeInference/composites-20.00B 0.00B ~(all equal)
SuperTypeInference/integers-20.00B 0.00B ~(all equal)
ValueIsSubtypeOfSemaType-248.0B ± 0%48.0B ± 0%~(all equal)
 
allocs/opdelta
CheckContractInterfaceFungibleTokenConformance-2815 ± 0%815 ± 0%~(all equal)
ContractInterfaceFungibleToken-2388 ± 0%388 ± 0%~(all equal)
InterpretRecursionFib-218.9k ± 0%18.9k ± 0%~(all equal)
NewInterpreter/new_interpreter-213.0 ± 0%13.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-24.00 ± 0%4.00 ± 0%~(all equal)
ParseArray-259.6k ± 0%59.6k ± 0%~(p=0.592 n=7+7)
ParseDeploy/byte_array-289.4k ± 0%89.4k ± 0%~(p=0.592 n=7+7)
ParseDeploy/decode_hex-264.0 ± 0%64.0 ± 0%~(all equal)
ParseFungibleToken/With_memory_metering-2779 ± 0%779 ± 0%~(all equal)
ParseFungibleToken/Without_memory_metering-2779 ± 0%779 ± 0%~(all equal)
ParseInfix-248.0 ± 0%48.0 ± 0%~(all equal)
QualifiedIdentifierCreation/One_level-20.00 0.00 ~(all equal)
QualifiedIdentifierCreation/Three_levels-22.00 ± 0%2.00 ± 0%~(all equal)
RuntimeFungibleTokenTransfer-21.99k ± 0%1.99k ± 0%~(all equal)
RuntimeResourceDictionaryValues-236.9k ± 0%36.9k ± 0%~(p=0.302 n=7+7)
RuntimeScriptNoop-2132 ± 0%132 ± 0%~(all equal)
SuperTypeInference/arrays-23.00 ± 0%3.00 ± 0%~(all equal)
SuperTypeInference/composites-20.00 0.00 ~(all equal)
SuperTypeInference/integers-20.00 0.00 ~(all equal)
ValueIsSubtypeOfSemaType-21.00 ± 0%1.00 ± 0%~(all equal)
 

@turbolent turbolent merged commit 4be06e2 into master Nov 28, 2022
@turbolent turbolent deleted the bastian/improve-sema branch November 28, 2022 17:58
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.

None yet

3 participants