Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
getOwnPropertyNames vs Object.keys - performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
getOwnPropertyNames
30381512.0 Ops/sec
Object.keys
30031426.0 Ops/sec
Script Preparation code:
var obj = { $props : ['a','b','c'], a:1, b:2, c:3 }
Tests:
getOwnPropertyNames
const arr = Object.getOwnPropertyNames(obj); let n = 0; for (let i = 0; i < arr.length; i++) { const k = arr[i]; if (k.charAt(0) == '$') continue; n++; }
Object.keys
const arr = Object.keys(obj); let n = 0; for (let i = 0; i < arr.length; i++) { const k = arr[i]; if (k.charAt(0) == '$') continue; n++; }