Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0
Firefox 124
Linux
Desktop
9 months ago
Test name Executions per second
action 687700352.0 Ops/sec
actionWithLog 66662.4 Ops/sec
actionWithLogData 58553.5 Ops/sec
Script Preparation code:
AخA
 
let counter = 0;
function action() {
  counter++;
}
function actionWithLog() {
  counter++;
  console.log('ok');
}
function actionWithLogData() {
  counter++;
  console.log('ok', counter);
}
Tests:
  • action

     
    action();
  • actionWithLog

     
    actionWithLog();
  • actionWithLogData

     
    actionWithLogData();