asdf

JavaScript performance comparison

Test case created

Preparation code

<textarea id="txtAreaID">
Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Suspendisse scelerisque
sem in leo venenatis
ornare. Aenean non
diam eget nisl
molestie mattis.
</textarea>
<script>
  var area = document.getElementById("txtAreaID");
  var rows = area.value.split(/\n/);
 
  var getTotal = function(row, col) {
   var tot = 0;
   var i;
   for (i = 0; i < (row - 1); i++) {
    tot += rows[i].length;
   };
   tot += col;
   return tot;
  };
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
fnc
var character_count = getTotal(5, 6);
pending…
crzy
var character_count = rows.slice(0, 4).join('').length + 6;
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