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

Gracefully handle casts during arithmetic operations #1306

Merged
merged 7 commits into from
Dec 18, 2021
Merged

Conversation

SupunS
Copy link
Member

@SupunS SupunS commented Dec 13, 2021

Description

Port of https://github.com/dapperlabs/cadence-internal/pull/37


  • 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

@github-actions
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 4fffc3b
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
RuntimeFungibleTokenTransfer-21.14ms ±23%1.07ms ±28%~(p=0.710 n=7+7)
ParseDeploy/decode_hex-21.11ms ± 7%1.06ms ± 3%~(p=0.128 n=7+7)
QualifiedIdentifierCreation/One_level-22.19ns ± 7%2.07ns ± 0%~(p=0.219 n=7+7)
ContractInterfaceFungibleToken-237.7µs ± 7%36.1µs ± 8%~(p=0.165 n=7+7)
CheckContractInterfaceFungibleTokenConformance-2127µs ±16%117µs ± 1%~(p=0.051 n=7+6)
InterpretRecursionFib-22.32ms ±10%2.17ms ± 6%~(p=0.165 n=7+7)
NewInterpreter/new_interpreter-2933ns ± 7%877ns ± 1%~(p=0.051 n=7+6)
NewInterpreter/new_sub-interpreter-21.88µs ± 7%1.75µs ± 1%~(p=0.137 n=7+7)
RuntimeResourceDictionaryValues-213.4ms ± 6%12.7ms ± 1%−5.54%(p=0.007 n=7+7)
ParseInfix-220.0µs ± 7%18.8µs ± 1%−5.89%(p=0.011 n=7+7)
ParseFungibleToken-2372µs ± 8%350µs ± 0%−5.98%(p=0.035 n=7+6)
QualifiedIdentifierCreation/Three_levels-2131ns ± 6%122ns ± 1%−6.67%(p=0.006 n=7+7)
ParseDeploy/byte_array-228.4ms ± 7%26.5ms ± 1%−6.72%(p=0.001 n=7+7)
ParseArray-218.8ms ± 9%17.3ms ± 1%−7.56%(p=0.001 n=7+7)
 
alloc/opdelta
RuntimeResourceDictionaryValues-24.04MB ± 0%4.04MB ± 0%~(p=0.165 n=7+7)
RuntimeFungibleTokenTransfer-2238kB ± 0%238kB ± 0%~(p=0.805 n=7+7)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
ContractInterfaceFungibleToken-226.5kB ± 0%26.5kB ± 0%~(all equal)
CheckContractInterfaceFungibleTokenConformance-265.7kB ± 0%65.7kB ± 0%~(p=0.592 n=7+7)
InterpretRecursionFib-21.24MB ± 0%1.24MB ± 0%~(p=0.303 n=5+7)
NewInterpreter/new_interpreter-2720B ± 0%720B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.18kB ± 0%1.18kB ± 0%~(all equal)
 
allocs/opdelta
RuntimeResourceDictionaryValues-2102k ± 0%102k ± 0%~(p=0.563 n=7+7)
RuntimeFungibleTokenTransfer-24.54k ± 0%4.54k ± 0%~(p=0.494 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)
InterpretRecursionFib-225.0k ± 0%25.0k ± 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)
 

Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

👍

@SupunS SupunS merged commit f5bd39d into master Dec 18, 2021
@SupunS SupunS deleted the supun/fix-numerics branch December 18, 2021 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants