Tests:
  • keys

    AخA
     
    const obj = {test1: 1, test2: 2, test3: 3};
    const isEmpty = Object.keys(obj).length === 0;
    return isEmpty;
  • values

     
    const obj = {test1: 1, test2: 2, test3: 3};
    const isEmpty = Object.values(obj).length === 0;
    return isEmpty;
  • json

     
    const obj = {test1: 1, test2: 2, test3: 3};
    const isEmpty = JSON.stringify(obj) === '{}';
    return isEmpty;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    keys
    values
    json

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
Chrome 70 on Mac OS X 10.13.6
View result in a separate tab
Test name Executions per second
keys 4893702.5 Ops/sec
values 4347775.5 Ops/sec
json 1550495.1 Ops/sec