LinkedList

JavaScript performance comparison

Revision 2 of this test case created

Info

LinkedList in JS vs Array.

Preparation code

<script src="http://www.pachisystems.com/LinkedList.min.js" type="text/javascript">
</script>
<script>
Benchmark.prototype.setup = function() {
    var data = [];
    for (var i = 0; i < 2000; i++) {
      data[i] = Math.random() * 1000;
    };
   
    var llist = new LinkedList();
    for (var i = 0; i < 2000; i++) {
      llist.add(Math.random() * 1000);
    };
   
    var sortFunction = function(a,b) {
      return a > b;
    };
};

Benchmark.prototype.teardown = function() {
    data = null;
    llist.clear();
};
</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
LinkedList Sort
// async test
llist.sort(sortFunction);
pending…
Array Sort
data.sort()
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