cadence icon indicating copy to clipboard operation
cadence copied to clipboard

Compiler/VM Optimizations

Open SupunS opened this issue 3 months ago • 0 comments

Quick wins / Low hanging:

most impactful potentially:

  • [ ] #4273
  • [ ] Reusing the VM (vm.NewVM call, need to make linking result reusable, ensure no values are used concurrently)

other:

  • [ ] Cache linking results from VM in FVM programs cache. But cannot include interpreter values
  • [ ] Make NativeFunctionValue, and other large types pointer types
  • [ ] #4239

Long term (more work):

  • [ ] #4305
  • [ ] Emit VM functions in compiler (Direct Call Threading)
  • [ ] Re-use getField results where possible (requires liveness analysis)
  • [ ] Add "resource-ness" (flag) to the static-type. Might need a state migration. (maybe not needed for the initial version)
    • Move resource-ness from instruction to static type (currently instructions have resource-nes operand)
  • [ ] Optimize conversion function calls
    • [ ] Constant literal argument (e.g. UInt32(1)) -> Emit constant load (GetConstant). avoids call
    • [ ] Other argument (e.g. let x: UInt8 = 1; UInt32(x)) -> Call specific target/source conversion function ($UInt8ToUInt32(x)). avoids run-time type dispatch in conversion function
  • [ ] concurrent processing in Cadence

SupunS avatar Nov 26 '25 20:11 SupunS