importBenchmarkfrom'benchmark'constsuite=newBenchmark.Suite()functionisEmpty1(obj){for(constpropinobj){if(Object.prototype.hasOwnProperty.call(obj,prop)){returnfalse}}returntrue}functionisEmpty2(obj){returnObject.getOwnPropertyNames(obj).length===0}suite.add('for ... in',function(){isEmpty1({a:1,b:2,c:3})})suite.add('keys',function(){isEmpty2({a:1,b:2,c:3})})suite.on('abort',function(){console.log('Aborted')})suite.on('error',function(event){console.log(String(JSON.stringify(event)))})suite.on('cycle',function(event){console.log(String(event.target))})suite.on('complete',function(){console.log('Fastest is '+this.filter('fastest').map('name'))})suite.run()