Array Set Difference

JavaScript performance comparison

Revision 7 of this test case created by Nathan

Preparation code

<script src="https://fireboltjs.com/firebolt.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
var array = [1,2,3,4,5,6,7,8,9,0],
    sub1 = [1,7,8,4],
    sub2 = [7,3,0];
</script>
    

Preparation code output

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
Firebolt
array.diff(sub1);
array.diff(sub1, sub2);
pending…
Lodash
_.difference(array, sub1);
_.difference(array, sub1, sub2);
pending…
jQuery
$(array).not(sub1);
$(array).not(sub1).not(sub2);
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.

0 Comments