Removing props

JavaScript performance comparison

Test case created by ktfth

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Removing a key
const stub = { a: 1, b: 'Fuzz', c: { d: 'too' } };
const removeProp = (o, k) => {
  let output = {};
  for (let [key, value] of Object.entries(o)) {
  	if (key !== k) output[key] = value;
  }
  return output;
};
let output = removeProp(stub, 'c');
console.log(output);
pending…
Deleting key
const stub = { a: 1, b: 'Fuzz', c: { d: 'too' } };
delete stub['c'];
console.log(stub);
pending…
Destructuring item
const stub = { a: 1, b: 'Fuzz', c: { d: 'too' } };
const { c, ...output } = stub;
console.log(output);
pending…

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments