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 test for CharacterValue.HashInput #1432

Merged
merged 1 commit into from
Mar 3, 2022

Conversation

robert-e-davidson3
Copy link
Contributor

@robert-e-davidson3 robert-e-davidson3 commented Feb 17, 2022

Closes nothing

Description

For some reason we don't have a test for CharacterValue hashing so I added one.

I used the example of a large grapheme cluster from the spec according to this blog post.

I didn't verify that the output value is correct because my intent here is just to add test coverage in case of regressions. But I can if desired.


  • 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 de9ccd9
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
QualifiedIdentifierCreation/One_level-22.42ns ± 0%2.49ns ± 7%+3.01%(p=0.015 n=6+7)
ContractInterfaceFungibleToken-239.7µs ± 0%40.9µs ± 6%+2.89%(p=0.017 n=7+7)
RuntimeResourceDictionaryValues-213.2ms ± 2%13.3ms ± 2%~(p=0.318 n=7+7)
RuntimeFungibleTokenTransfer-21.01ms ±32%1.12ms ±23%~(p=0.383 n=7+7)
ParseDeploy/byte_array-218.6ms ± 0%18.6ms ± 2%~(p=0.628 n=6+7)
ParseDeploy/decode_hex-21.13ms ± 0%1.13ms ± 0%~(p=0.101 n=6+7)
ParseInfix-28.62µs ± 6%8.47µs ± 0%~(p=0.366 n=7+6)
ParseArray-212.4ms ± 9%12.4ms ± 9%~(p=0.318 n=7+7)
ParseFungibleToken-2183µs ± 1%182µs ± 0%~(p=0.234 n=7+6)
QualifiedIdentifierCreation/Three_levels-2123ns ± 0%123ns ± 0%~(p=0.976 n=7+7)
CheckContractInterfaceFungibleTokenConformance-2127µs ± 0%127µs ± 1%~(p=1.000 n=6+7)
InterpretRecursionFib-22.51ms ± 1%2.50ms ± 1%~(p=0.589 n=6+6)
NewInterpreter/new_interpreter-21.04µs ± 0%1.04µs ± 1%~(p=0.254 n=6+7)
NewInterpreter/new_sub-interpreter-22.18µs ± 2%2.17µs ± 1%~(p=0.225 n=6+6)
 
alloc/opdelta
RuntimeResourceDictionaryValues-24.05MB ± 0%4.05MB ± 0%~(p=0.318 n=7+7)
RuntimeFungibleTokenTransfer-2282kB ± 0%282kB ± 0%~(p=0.097 n=7+7)
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%~(all equal)
ContractInterfaceFungibleToken-226.6kB ± 0%26.6kB ± 0%~(p=0.592 n=7+7)
InterpretRecursionFib-21.24MB ± 0%1.24MB ± 0%~(all equal)
NewInterpreter/new_interpreter-2768B ± 0%768B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.24kB ± 0%1.24kB ± 0%~(all equal)
 
allocs/opdelta
RuntimeResourceDictionaryValues-2102k ± 0%102k ± 0%~(p=0.139 n=7+7)
RuntimeFungibleTokenTransfer-24.54k ± 0%4.54k ± 0%~(p=0.735 n=7+7)
QualifiedIdentifierCreation/One_level-20.00 0.00 ~(all equal)
QualifiedIdentifierCreation/Three_levels-22.00 ± 0%2.00 ± 0%~(all equal)
CheckContractInterfaceFungibleTokenConformance-21.07k ± 0%1.07k ± 0%~(all equal)
ContractInterfaceFungibleToken-2458 ± 0%458 ± 0%~(all equal)
InterpretRecursionFib-225.0k ± 0%25.0k ± 0%~(all equal)
NewInterpreter/new_interpreter-212.0 ± 0%12.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-238.0 ± 0%38.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.

Great catch and great test case! 👍

@robert-e-davidson3 robert-e-davidson3 merged commit 664d34a into master Mar 3, 2022
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.

3 participants