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

PoC: Build Bytecode Quickly (BBQ) #2088

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

PoC: Build Bytecode Quickly (BBQ) #2088

wants to merge 1 commit into from

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Oct 21, 2022

Description

A proof-of-concept compiler and VM for a subset of Cadence.

(Name adopted from WebKit/JavaScriptCore)


  • 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

@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Attention: Patch coverage is 72.34600% with 211 lines in your changes missing coverage. Please review.

Project coverage is 77.61%. Comparing base (88038cf) to head (b17343d).
Report is 5677 commits behind head on master.

Files with missing lines Patch % Lines
runtime/bbq/compiler/compiler.go 64.63% 111 Missing and 11 partials ⚠️
runtime/bbq/constantkind/constantkind.go 9.09% 40 Missing ⚠️
runtime/bbq/leb128/leb128.go 82.08% 20 Missing and 4 partials ⚠️
runtime/bbq/vm/vm.go 90.76% 15 Missing and 3 partials ⚠️
runtime/bbq/opcode/opcode_string.go 0.00% 5 Missing ⚠️
runtime/bbq/compiler/function.go 90.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2088      +/-   ##
==========================================
- Coverage   77.68%   77.61%   -0.07%     
==========================================
  Files         303      311       +8     
  Lines       63335    64098     +763     
==========================================
+ Hits        49199    49751     +552     
- Misses      12381    12573     +192     
- Partials     1755     1774      +19     
Flag Coverage Δ
unittests 77.61% <72.34%> (-0.07%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 88038cf
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-2119µs ± 1%118µs ± 1%~(p=0.535 n=7+7)
ContractInterfaceFungibleToken-241.3µs ± 0%42.4µs ± 8%~(p=0.788 n=5+7)
InterpretRecursionFib-22.56ms ± 1%2.65ms ± 7%~(p=0.053 n=7+7)
NewInterpreter/new_interpreter-21.16µs ± 1%1.15µs ± 1%~(p=0.056 n=6+6)
NewInterpreter/new_sub-interpreter-2618ns ± 1%610ns ± 1%−1.28%(p=0.002 n=7+7)
ParseArray-28.24ms ± 2%8.18ms ± 1%~(p=0.138 n=7+6)
ParseDeploy/byte_array-212.5ms ± 1%12.5ms ± 1%~(p=0.628 n=6+7)
ParseDeploy/decode_hex-21.22ms ± 2%1.22ms ± 1%~(p=0.628 n=6+7)
ParseFungibleToken/With_memory_metering-2191µs ± 2%190µs ± 1%~(p=0.383 n=7+7)
ParseFungibleToken/Without_memory_metering-2152µs ± 1%152µs ± 1%~(p=0.731 n=6+7)
ParseInfix-27.20µs ± 1%7.19µs ± 1%~(p=0.535 n=7+7)
QualifiedIdentifierCreation/One_level-22.35ns ± 0%2.35ns ± 0%~(p=0.783 n=7+7)
QualifiedIdentifierCreation/Three_levels-2138ns ± 1%137ns ± 0%~(p=0.379 n=6+7)
RuntimeFungibleTokenTransfer-2647µs ±36%687µs ±24%~(p=0.805 n=7+7)
RuntimeResourceDictionaryValues-25.23ms ± 4%5.18ms ± 2%~(p=0.383 n=7+7)
RuntimeScriptNoop-221.7µs ±31%20.3µs ±26%~(p=0.710 n=7+7)
ValueIsSubtypeOfSemaType-2104ns ± 0%105ns ± 1%+0.99%(p=0.001 n=6+7)
 
alloc/opdelta
CheckContractInterfaceFungibleTokenConformance-251.0kB ± 0%51.0kB ± 0%~(p=0.409 n=7+7)
ContractInterfaceFungibleToken-224.2kB ± 0%24.2kB ± 0%~(all equal)
InterpretRecursionFib-21.00MB ± 0%1.00MB ± 0%~(p=0.923 n=7+6)
NewInterpreter/new_interpreter-2800B ± 0%800B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-2216B ± 0%216B ± 0%~(all equal)
ParseArray-22.70MB ± 1%2.69MB ± 2%~(p=0.710 n=6+7)
ParseDeploy/byte_array-24.21MB ± 3%4.29MB ± 0%~(p=0.295 n=7+6)
ParseDeploy/decode_hex-2214kB ± 0%214kB ± 0%~(p=0.846 n=7+7)
ParseFungibleToken/With_memory_metering-229.4kB ± 0%29.4kB ± 0%~(p=0.735 n=7+7)
ParseFungibleToken/Without_memory_metering-229.4kB ± 0%29.4kB ± 0%~(p=1.000 n=7+7)
ParseInfix-21.93kB ± 0%1.93kB ± 0%~(p=0.170 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.620 n=7+7)
RuntimeResourceDictionaryValues-22.27MB ± 0%2.27MB ± 0%~(p=0.902 n=7+7)
RuntimeScriptNoop-28.83kB ± 0%8.83kB ± 0%~(p=0.675 n=6+6)
ValueIsSubtypeOfSemaType-248.0B ± 0%48.0B ± 0%~(all equal)
 
allocs/opdelta
CheckContractInterfaceFungibleTokenConformance-2915 ± 0%915 ± 0%~(all equal)
ContractInterfaceFungibleToken-2436 ± 0%436 ± 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-269.6k ± 0%69.6k ± 0%~(p=0.592 n=7+7)
ParseDeploy/byte_array-2104k ± 0%104k ± 0%~(p=0.592 n=7+7)
ParseDeploy/decode_hex-275.0 ± 0%75.0 ± 0%~(all equal)
ParseFungibleToken/With_memory_metering-20.99k ± 0%0.99k ± 0%~(all equal)
ParseFungibleToken/Without_memory_metering-20.99k ± 0%0.99k ± 0%~(all equal)
ParseInfix-260.0 ± 0%60.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.06k ± 0%2.06k ± 0%~(p=0.462 n=7+7)
RuntimeResourceDictionaryValues-236.9k ± 0%36.9k ± 0%~(p=0.706 n=7+7)
RuntimeScriptNoop-2145 ± 0%145 ± 0%~(all equal)
ValueIsSubtypeOfSemaType-21.00 ± 0%1.00 ± 0%~(all equal)
 

@SupunS SupunS mentioned this pull request Oct 28, 2024
6 tasks
@turbolent turbolent self-assigned this Oct 30, 2024
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.

1 participant