Question about IC.countInstructions

is the number returned by this equals to the actual count of cycles consumed?

for example:

let countA = IC.countInstructions(func() {
      var a = 1;
      var i = 0;
      while (i < pow) {
        a := a * 2;
        i += 1;
      };
    });

No, countInstructions returns WebAssembly instructions, not cycles.

  • Instructions to cycles: fixed rate, ~0.4 cycles/instruction on a standard app subnet (10 instructions ~= 4 cycles), higher on larger subnets.
  • Even after converting, it won’t match your bill because it excludes: per-message base fees, payload/byte costs, garbage collection, and anything after an await (counter resets there).

Use it for relative profiling, comparing implementations or seeing how cost scales. Not for exact cycle accounting.

Holy crap forgot about this. Thanks quint.

If you don’t mind can you look at the design doc I put up for the next version of canic? Run it through an LLM with more specific feedback as you’re more knowledgeable about this.

@bjoern - please give it a look too.

Cluj Napoca lol. Don’t make me come there.

Fabricated screenshots…lol. This is typical in the Toko discord.

Stop tagging me please. I’m not interested in this foolishness.