I did not know that Motoko Playground had started to support profiling. This is huge for me, great work!
I have a few questions regarding the interpretation of the profiling data after reading the design document and experimenting with it a bit in the playground:
- Immediately when I deploy a canister I get an output as shown below. Does this represent instructions for installing the canister code? If so, is that a cycles cost on top of the Canister Created cost here?
Wasm instructions executed 4246 instrs.
- When looking at the flame graph below of the
insert()
function from the Phone Book example, does the number of instructions (3891) represent the number of “pure” Wasm instructions or the weighted number of instructions where some system API calls are counted as multiple instructions (as discussed here)?
The reason I’m asking is because I want to know if it is correct to divide the number of instructions by 10 and multiply by 4 to get the cycles cost of the execution, or if there is more to it.
- Again using the Phone Book example in the playground, I measure three operations where I insert three records one after the other in the same canister. See results below. What causes the same function to vary in instructions count based on different inputs?
insert(“aaa”, record {desc=“aaa”; phone=“111”})
insert: 5970 instrs
insert(“bbb”, record {desc=“bbb”; phone=“222”})
insert: 7345 instrs
insert(“ccc”, record {desc=“ccc”; phone=“333”})
insert: 5807 instrs
- When I run the
lookup()
function, which is a query call, a number of instructions is shown from the profiling. Can these be ignored when calculating cycles costs of a canister, since (if I’m not mistaken) query calls are currently free?
- Does the profiling support inter-canister calls, as in that you may see the combined number of instructions?