Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Reflect.has vs Direct Check
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Reflect
101224816.0 Ops/sec
Direct
1112109952.0 Ops/sec
Script Preparation code:
appConfig = { name: 'John', age: 30, address: { street: '123 Main St', city: 'Anytown', state: 'CA', zip: '12345' }, hobbies: ['reading', 'painting', 'hiking', 'cooking', 'traveling', 'photography', 'gaming', 'writing', 'yoga', 'dancing'], favoriteFoods: [{ name: 'Pizza', type: 'Italian', ingredients: ['cheese', 'pepperoni', 'mushrooms', 'olives', 'tomatoes'] }, { name: 'Sushi', type: 'Japanese', ingredients: ['rice', 'nori', 'fish', 'vegetables', 'wasabi', 'soy sauce'] }, { name: 'Tacos', type: 'Mexican', ingredients: ['tortillas', 'beef', 'chicken', 'beans', 'lettuce', 'tomatoes', 'salsa', 'guacamole'] } ], friends: [{ name: 'Sarah', age: 28, address: { street: '456 Elm St', city: 'Anytown', state: 'CA', zip: '12345' }, hobbies: ['reading', 'traveling', 'hiking'], favoriteFoods: [{ name: 'Pad Thai', type: 'Thai', ingredients: ['noodles', 'shrimp', 'tofu', 'peanuts', 'vegetables', 'spices'] }, { name: 'Biryani', type: 'Indian', ingredients: ['rice', 'chicken', 'spices', 'yogurt', 'onions'] } ] }, { name: 'Tom', age: 32, address: { street: '789 Oak St', city: 'Anytown', state: 'CA', zip: '12345' }, hobbies: ['gaming', 'photography', 'traveling'], favoriteFoods: [{ name: 'Burger', type: 'American', ingredients: ['beef', 'bun', 'cheese', 'lettuce', 'tomato', 'onion', 'pickles', 'ketchup', 'mustard'] }, { name: 'Sushi', type: 'Japanese', ingredients: ['rice', 'nori', 'fish', 'vegetables', 'wasabi', 'soy sauce'] } ] } ] };
Tests:
Reflect
const key = 'name1'; if (Reflect.has(appConfig, key)) { console.log(appConfig[key]); }
Direct
const key = 'name1'; if (appConfig[key]) { console.log(appConfig[key]); }