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 reference expressions #2010

Merged
merged 7 commits into from Sep 28, 2022

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Sep 27, 2022

Re-port of #1661 to Stable Cadence.
It had been previously accidentally reverted by merging master into the Stable Cadence branch

Also:

  • Update documentation
  • Make parser-initalization errors non-syntax errors: they are implementation errors and not user errors.

  • 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 added the Language Breaking Change Breaks Cadence contracts deployed on Mainnet label Sep 27, 2022
@turbolent turbolent self-assigned this Sep 27, 2022
@turbolent turbolent requested a review from a team September 27, 2022 21:58
@codecov
Copy link

codecov bot commented Sep 27, 2022

Codecov Report

Merging #2010 (0a9e891) into feature/stable-cadence (5a45664) will increase coverage by 0.00%.
The diff coverage is 81.81%.

❗ Current head 0a9e891 differs from pull request most recent head 999bb0c. Consider uploading reports for the commit 999bb0c to get more accurate results

@@                   Coverage Diff                   @@
##           feature/stable-cadence    #2010   +/-   ##
=======================================================
  Coverage                   77.96%   77.97%           
=======================================================
  Files                         304      304           
  Lines                       62318    62307   -11     
=======================================================
- Hits                        48589    48581    -8     
+ Misses                      12016    12014    -2     
+ Partials                     1713     1712    -1     
Flag Coverage Δ
unittests 77.97% <81.81%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
runtime/parser/errors.go 24.35% <ø> (-3.69%) ⬇️
runtime/parser/type.go 84.14% <0.00%> (ø)
runtime/parser/expression.go 87.91% <70.00%> (+0.13%) ⬆️
runtime/ast/expression.go 90.97% <100.00%> (-0.05%) ⬇️
runtime/literal.go 86.56% <100.00%> (+0.16%) ⬆️
runtime/sema/check_array_expression.go 100.00% <100.00%> (ø)
runtime/sema/check_dictionary_expression.go 100.00% <100.00%> (ø)
runtime/sema/check_reference_expression.go 100.00% <100.00%> (ø)

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

github-actions bot commented Sep 27, 2022

Cadence Benchstat comparison

This branch with compared with the base branch onflow:feature/stable-cadence commit 5a45664
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-2138µs ± 2%136µs ± 2%~(p=0.093 n=6+6)
ContractInterfaceFungibleToken-240.4µs ± 1%40.5µs ± 0%~(p=0.945 n=7+6)
InterpretRecursionFib-22.66ms ± 2%2.64ms ± 1%−1.00%(p=0.041 n=6+6)
NewInterpreter/new_interpreter-21.16µs ± 0%1.19µs ± 3%+2.27%(p=0.004 n=5+6)
NewInterpreter/new_sub-interpreter-2661ns ± 0%668ns ± 1%+1.01%(p=0.004 n=5+6)
ParseArray-28.84ms ± 6%8.85ms ± 4%~(p=0.710 n=7+7)
ParseDeploy/byte_array-213.2ms ± 2%13.2ms ± 4%~(p=0.534 n=6+7)
ParseDeploy/decode_hex-21.16ms ± 3%1.15ms ± 1%~(p=0.097 n=7+7)
ParseFungibleToken/With_memory_metering-2214µs ± 1%213µs ± 0%~(p=0.234 n=7+6)
ParseFungibleToken/Without_memory_metering-2166µs ± 0%170µs ± 4%+2.33%(p=0.005 n=6+7)
ParseInfix-27.74µs ± 1%7.71µs ± 1%~(p=0.136 n=7+7)
QualifiedIdentifierCreation/One_level-22.34ns ± 0%2.68ns ± 1%+14.47%(p=0.001 n=6+7)
QualifiedIdentifierCreation/Three_levels-2140ns ± 0%142ns ± 2%+1.13%(p=0.020 n=7+7)
RuntimeFungibleTokenTransfer-2750µs ± 3%643µs ±25%~(p=0.259 n=7+7)
RuntimeResourceDictionaryValues-25.24ms ± 2%5.25ms ± 3%~(p=0.710 n=7+7)
RuntimeScriptNoop-219.2µs ±23%20.2µs ±27%~(p=0.902 n=7+7)
ValueIsSubtypeOfSemaType-293.4ns ± 1%92.2ns ± 1%−1.31%(p=0.001 n=6+7)
 
alloc/opdelta
CheckContractInterfaceFungibleTokenConformance-261.6kB ± 0%61.6kB ± 0%~(p=0.592 n=7+7)
ContractInterfaceFungibleToken-224.0kB ± 0%24.0kB ± 0%~(p=0.385 n=7+6)
InterpretRecursionFib-21.23MB ± 0%1.23MB ± 0%~(p=0.449 n=7+7)
NewInterpreter/new_interpreter-2848B ± 0%848B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-2264B ± 0%264B ± 0%~(all equal)
ParseArray-22.81MB ± 2%2.82MB ± 2%~(p=0.805 n=7+7)
ParseDeploy/byte_array-24.39MB ± 3%4.39MB ± 3%~(p=0.805 n=7+7)
ParseDeploy/decode_hex-2214kB ± 0%214kB ± 0%~(p=0.888 n=7+7)
ParseFungibleToken/With_memory_metering-236.7kB ± 0%36.7kB ± 0%~(p=0.490 n=7+7)
ParseFungibleToken/Without_memory_metering-236.7kB ± 0%36.7kB ± 0%+0.04%(p=0.033 n=6+7)
ParseInfix-22.17kB ± 0%2.17kB ± 0%~(p=0.700 n=7+7)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
RuntimeFungibleTokenTransfer-2111kB ± 0%111kB ± 1%~(p=0.097 n=7+7)
RuntimeResourceDictionaryValues-22.27MB ± 0%2.27MB ± 0%~(p=0.383 n=7+7)
RuntimeScriptNoop-28.73kB ± 1%8.73kB ± 0%~(p=1.000 n=7+6)
ValueIsSubtypeOfSemaType-248.0B ± 0%48.0B ± 0%~(all equal)
 
allocs/opdelta
CheckContractInterfaceFungibleTokenConformance-21.03k ± 0%1.03k ± 0%~(all equal)
ContractInterfaceFungibleToken-2427 ± 0%427 ± 0%~(all equal)
InterpretRecursionFib-222.5k ± 0%22.5k ± 0%~(all equal)
NewInterpreter/new_interpreter-214.0 ± 0%14.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-25.00 ± 0%5.00 ± 0%~(all equal)
ParseArray-270.0k ± 0%70.0k ± 0%~(p=1.000 n=7+7)
ParseDeploy/byte_array-2105k ± 0%105k ± 0%~(p=1.000 n=7+7)
ParseDeploy/decode_hex-277.0 ± 0%77.0 ± 0%~(all equal)
ParseFungibleToken/With_memory_metering-21.07k ± 0%1.07k ± 0%~(all equal)
ParseFungibleToken/Without_memory_metering-21.07k ± 0%1.07k ± 0%~(all equal)
ParseInfix-266.0 ± 0%66.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-22.20k ± 0%2.20k ± 0%~(p=0.462 n=7+7)
RuntimeResourceDictionaryValues-236.9k ± 0%36.9k ± 0%~(p=1.000 n=7+7)
RuntimeScriptNoop-2145 ± 0%145 ± 0%~(all equal)
ValueIsSubtypeOfSemaType-21.00 ± 0%1.00 ± 0%~(all equal)
 

@turbolent turbolent requested review from SupunS and a team September 28, 2022 17:07
@turbolent turbolent merged commit 5bba764 into feature/stable-cadence Sep 28, 2022
@turbolent turbolent deleted the bastian/improve-references branch September 28, 2022 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Breaking Change Breaks Cadence contracts deployed on Mainnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants