Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
object.keys vs entries + filtering
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.entries + filtering
636651.2 Ops/sec
Object.keys + filtering
959155.8 Ops/sec
Script Preparation code:
var participants = { "14395101": { "hidden": false, "notificationPreference": "always" }, "24580932": { "hidden": true, "notificationPreference": "always" }, "31245789": { "hidden": false, "notificationPreference": "always" }, "49801234": { "hidden": true, "notificationPreference": "always" }, "56710248": { "hidden": false, "notificationPreference": "always" }, "62378901": { "hidden": true, "notificationPreference": "always" }, "78549210": { "hidden": false, "notificationPreference": "always" }, "84792154": { "hidden": true, "notificationPreference": "always" }, "91234560": { "hidden": false, "notificationPreference": "always" }, "10345678": { "hidden": true, "notificationPreference": "always" } };
Tests:
Object.entries + filtering
let participantsEntries = Object.entries(participants); const currentUserAccountID = 13; participantsEntries.filter(([accountID, participant]) => { if (Number(accountID) === currentUserAccountID) { return false; } if (participant.hidden) { return false; } return true; });
Object.keys + filtering
let participantsIDs = Object.keys(participants).map(Number); const currentUserAccountID = 13; participantsIDs.filter((accountID) => { if (accountID === currentUserAccountID) { return false; } if (participants[accountID].hidden) { return false; } return true; });