delete vs. _.omit

JavaScript performance comparison

Test case created by Dylan Pyle

Preparation code

<script src="//underscorejs.org/underscore.js"></script>
<script>
Benchmark.prototype.setup = function() {
    var datum = {
      a: 1,
      b: 2,
      c: 3,
      d: 4,
      e: 5,
      f: 6,
      g: 7
    };
     
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
delete dot
delete datum.a;
pending…
delete brackets
delete datum['a'];
pending…
underscore omit
datum = _.omit(datum, 'a');
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment