Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Chrome 97
Windows
Desktop
2 years ago
Test name Executions per second
Object.keys 3195904.0 Ops/sec
_.isEmpty 2740095.0 Ops/sec
HTML Preparation code:
AخA
 
1
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script>
Script Preparation code:
 
window.obj = {};
Tests:
  • Object.keys

     
    Object.keys(window.obj).length === 0;
  • _.isEmpty

     
    _.isEmpty(window.obj);