Skip to content

Conversation

@SupunS
Copy link
Member

@SupunS SupunS commented Nov 28, 2025

Description

💡Idea:

  • When running the test with the compiler, while compiling and preparing the VM, also prepare an interpreter and have it ready.
  • Then when invoking the test function with the VM, also invoke the same with the interpreter.
  • Then compare the slabs in the two storages.

⚠️ Note:

Above happens when the compile flag is on for tests, and we already run the tests purely with the interpreter separately as well. This means we are running the tests with the interpreter twice, effectively. We could theoretically remove the separate run of the interpreter tests. But it might need some more work, so kept it as-is for now,


  • 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 Nov 28, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

Benchstat comparison

  • Base branch: onflow:master
  • Base commit: 51f8c50
Results

old.txtnew.txt
time/opdelta
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-4397µs ± 0%401µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
Emit-44.11ms ± 0%4.14ms ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-4265ns ± 0%266ns ± 0%~(p=1.000 n=1+1)
ExportType/simple_type-478.1ns ± 0%77.9ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-421.2µs ± 0%21.2µs ± 0%~(p=1.000 n=1+1)
InterpretRecursionFib-42.07ms ± 0%2.16ms ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_interpreter-4910ns ± 0%840ns ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_sub-interpreter-4315ns ± 0%316ns ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-4570µs ± 0%588µs ± 0%~(p=1.000 n=1+1)
RuntimeFungibleTokenTransferVM-4659µs ± 0%659µs ± 0%~(p=1.000 n=1+1)
RuntimeResourceDictionaryValues-42.65ms ± 0%2.64ms ± 0%~(p=1.000 n=1+1)
RuntimeResourceTracking-411.9ms ± 0%11.8ms ± 0%~(p=1.000 n=1+1)
RuntimeScriptNoop-414.5µs ± 0%15.0µs ± 0%~(p=1.000 n=1+1)
RuntimeVMInvokeContractImperativeFib-427.5µs ± 0%27.5µs ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-459.5ns ± 0%60.5ns ± 0%~(p=1.000 n=1+1)
 
alloc/opdelta
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-4152kB ± 0%152kB ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
Emit-41.46MB ± 0%1.46MB ± 0%~(p=1.000 n=1+1)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-4120B ± 0%120B ± 0%~(all equal)
ExportType/simple_type-40.00B 0.00B ~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-48.30kB ± 0%8.30kB ± 0%~(all equal)
InterpretRecursionFib-41.19MB ± 0%1.19MB ± 0%~(p=1.000 n=1+1)
NewInterpreter/new_interpreter-4976B ± 0%976B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-4232B ± 0%232B ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-4158kB ± 0%158kB ± 0%~(p=1.000 n=1+1)
RuntimeFungibleTokenTransferVM-4173kB ± 0%172kB ± 0%~(p=1.000 n=1+1)
RuntimeResourceDictionaryValues-41.76MB ± 0%1.76MB ± 0%~(p=1.000 n=1+1)
RuntimeResourceTracking-49.27MB ± 0%9.25MB ± 0%~(p=1.000 n=1+1)
RuntimeScriptNoop-47.98kB ± 0%8.00kB ± 0%~(p=1.000 n=1+1)
RuntimeVMInvokeContractImperativeFib-49.80kB ± 0%9.80kB ± 0%~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-432.0B ± 0%32.0B ± 0%~(all equal)
 
allocs/opdelta
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ContractFunctionInvocation-42.46k ± 0%2.46k ± 0%~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
Emit-439.0k ± 0%39.0k ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
ExportType/composite_type-43.00 ± 0%3.00 ± 0%~(all equal)
ExportType/simple_type-40.00 0.00 ~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ImperativeFib-4176 ± 0%176 ± 0%~(all equal)
InterpretRecursionFib-417.7k ± 0%17.7k ± 0%~(all equal)
NewInterpreter/new_interpreter-415.0 ± 0%15.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-44.00 ± 0%4.00 ± 0%~(all equal)
pkg:github.com/onflow/cadence/runtime goos:linux goarch:amd64
RuntimeFungibleTokenTransferInterpreter-42.98k ± 0%2.98k ± 0%~(all equal)
RuntimeFungibleTokenTransferVM-43.02k ± 0%3.02k ± 0%~(all equal)
RuntimeResourceDictionaryValues-436.7k ± 0%36.7k ± 0%~(all equal)
RuntimeResourceTracking-4159k ± 0%159k ± 0%~(p=1.000 n=1+1)
RuntimeScriptNoop-4113 ± 0%113 ± 0%~(all equal)
RuntimeVMInvokeContractImperativeFib-4197 ± 0%197 ± 0%~(all equal)
pkg:github.com/onflow/cadence/interpreter goos:linux goarch:amd64
ValueIsSubtypeOfSemaType-41.00 ± 0%1.00 ± 0%~(all equal)
 

@SupunS SupunS force-pushed the supun/compare-slabs branch from 116a6d7 to cdb6213 Compare December 2, 2025 02:19
@SupunS SupunS self-assigned this Dec 2, 2025
@SupunS SupunS added the Testing label Dec 2, 2025
@SupunS SupunS marked this pull request as ready for review December 2, 2025 20:51
@SupunS SupunS force-pushed the supun/compare-slabs branch from cc120f8 to f5803ac Compare December 2, 2025 20:54
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 work! This is really useful for making sure the compiler/VM matches the interpreter

@SupunS SupunS force-pushed the supun/compare-slabs branch from ddb6914 to 0269d76 Compare December 3, 2025 16:00
@SupunS SupunS merged commit 60e882a into master Dec 3, 2025
17 checks passed
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.

4 participants