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

Add optional resource owner change tracking callback #1289

Merged
merged 9 commits into from
Dec 11, 2021

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Dec 2, 2021

Closes #1288

Description

Allow the host environment to observe the ownership changes of resources by adding a callback to the interpreter and runtime interface.

Also, remove the unnecessary parameters from CompositeValue.GetField.


  • 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

github-actions bot commented Dec 2, 2021

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit a9ef2ce
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.44µs ± 3%2.68µs ± 8%+9.69%(p=0.001 n=7+7)
RuntimeResourceDictionaryValues-218.1ms ± 4%18.1ms ± 7%~(p=0.902 n=7+7)
RuntimeFungibleTokenTransfer-21.53ms ±29%1.54ms ±16%~(p=0.710 n=7+7)
ParseArray-225.8ms ± 1%26.4ms ± 2%~(p=0.073 n=6+7)
ParseDeploy/byte_array-239.4ms ± 7%40.3ms ± 7%~(p=0.318 n=7+7)
ParseDeploy/decode_hex-21.53ms ± 3%1.54ms ± 4%~(p=1.000 n=7+7)
ParseInfix-227.7µs ± 4%27.5µs ± 3%~(p=0.596 n=7+7)
ParseFungibleToken-2524µs ± 5%521µs ± 4%~(p=1.000 n=7+6)
QualifiedIdentifierCreation/One_level-22.94ns ± 0%2.94ns ± 1%~(p=0.943 n=6+7)
QualifiedIdentifierCreation/Three_levels-2182ns ± 5%185ns ± 6%~(p=0.558 n=7+7)
ContractInterfaceFungibleToken-255.3µs ± 7%52.9µs ± 4%~(p=0.097 n=7+7)
CheckContractInterfaceFungibleTokenConformance-2173µs ± 3%173µs ± 5%~(p=1.000 n=7+7)
NewInterpreter/new_interpreter-21.31µs ± 5%1.32µs ± 8%~(p=1.000 n=7+7)
InterpretRecursionFib-23.06ms ± 7%2.99ms ± 2%~(p=0.318 n=7+7)
 
alloc/opdelta
NewInterpreter/new_sub-interpreter-21.11kB ± 0%1.18kB ± 0%+5.76%(p=0.001 n=7+7)
RuntimeFungibleTokenTransfer-2238kB ± 0%238kB ± 0%+0.05%(p=0.001 n=7+7)
RuntimeResourceDictionaryValues-24.04MB ± 0%4.04MB ± 0%~(p=0.073 n=7+6)
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.140 n=6+7)
NewInterpreter/new_interpreter-2720B ± 0%720B ± 0%~(all equal)
InterpretRecursionFib-21.24MB ± 0%1.24MB ± 0%~(p=1.000 n=7+7)
 
allocs/opdelta
NewInterpreter/new_sub-interpreter-232.0 ± 0%36.0 ± 0%+12.50%(p=0.001 n=7+7)
RuntimeFungibleTokenTransfer-24.53k ± 0%4.54k ± 0%+0.19%(p=0.001 n=7+7)
RuntimeResourceDictionaryValues-2102k ± 0%102k ± 0%+0.01%(p=0.001 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)
NewInterpreter/new_interpreter-211.0 ± 0%11.0 ± 0%~(all equal)
InterpretRecursionFib-225.0k ± 0%25.0k ± 0%~(all equal)
 

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.

LGTM!

@turbolent turbolent merged commit 4fffc3b into master Dec 11, 2021
@turbolent turbolent deleted the bastian/1288-resource-owner-change-tracking branch December 11, 2021 02:35
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.

Add resource ownership change handler to interpreter
2 participants