Does eosio::print cost CPU cycles to execute on the BPs? On my node I have an option to print. Assuming it is disabled for the BPs (print defined to return; or similar), does evaluating the arguments cost CPU cycles, e.g.

print("Hi", expensiveFunction());

1 Answer 1


print() appears to cost CPU cycles and expensiveFunction() is evaluated. I tried with the following. As there is no sleep I just looped (the expensive function takes about 50 ms > 30 ms allowed on the test node). This results in Error 3080006: Transaction took too long

string expensiveFunction()
  int volatile i = 0;
  for(; i<600000;)
  return to_string(i);

ACTION performance::testprint()
  print("hi", expensiveFunction());
  • We decided to avoid this by putting a macro around the print commands like D(print(...);). The macro looks like this #define DEBUG 0 #if DEBUG #define D(x) x #else #define D(x) #endif
    – colin
    Commented Dec 20, 2018 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.