Test name | Executions per second |
---|---|
getOwnPropertyNames | 183718.3 Ops/sec |
getOwnPropertyDescriptors | 90338.9 Ops/sec |
function objectProperties(object, result = {}) {
let proto = object;
while ((proto = Object.getPrototypeOf(proto)) !== Object.prototype) {
for(const name of Object.getOwnPropertyNames(proto)) {
result[name] = name;
}
}
return result;
}
objectProperties(new MediaSource());
function objectProperties(object, result = {}) {
let proto = object;
while ((proto = Object.getPrototypeOf(proto)) !== Object.prototype) {
for(const descriptor in Object.getOwnPropertyDescriptors(proto)) {
result[descriptor] = descriptor;
}
}
return result;
}
objectProperties(new MediaSource());