Script Preparation code:
x
 
var a = "Here's a string value";
var b = 5; // and a number
var c = false;
var object = {
  a, b, c
}
var array = [
  a, b, c
];
var passObject = (obj) => {
  return obj.a.length + obj.b * obj.c ? 2 : 1;
}
var passRawValues = (val_a, val_b, val_c) => {
  return val_a.length + val_b * val_c ? 2 : 1;
}
var passArray = (arr) => {
  return arr[0].length + arr[1] * arr[2] ? 2 : 1;
}
var x = 0;
Tests:
  • Pass object

     
    x << 1;
    x ^= passObject(object);
  • Pass raw values

     
    x << 1;
    x ^= passRawValues(a, b, c);
  • Pass array

     
    x << 1;
    x ^= passArray(array);
  • Pass new object

     
    x << 1;
    x ^= passObject({a, b, c});
  • Pass re-created object

     
    object.a = a;
    object.b = b;
    object.c = c;
    x << 1;
    x ^= passObject(object);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Pass object
    Pass raw values
    Pass array
    Pass new object
    Pass re-created object

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Chrome 109 on Windows
View result in a separate tab
Test name Executions per second
Pass object 3894234.2 Ops/sec
Pass raw values 2746705.0 Ops/sec
Pass array 3876710.0 Ops/sec
Pass new object 2765405.8 Ops/sec
Pass re-created object 1771387.2 Ops/sec