JavaScript performance comparison

Test case created by Poch

Preparation code

<div id="test1">T1 : </div>
<div id="test2">T2 : </div>
Benchmark.prototype.setup = function() {
    var tickId = 999;
    var orders = "3ff";

Preparation code output

T1 :

T2 :

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Classic JSONize
var dto = {i:tickId, o:orders};
var jsonDTO = JSON.stringify(dto);
jsonDTO = jsonDTO.replace(new RegExp('"', 'g'), "'");

if (!window.test1ResultDisplayed) {
      document.getElementById("test1").innerHTML += jsonDTO;
      window.test1ResultDisplayed = true;
Manual assembly
var dto = "["+tickId+",'"+orders+"']";

if (!window.test2ResultDisplayed) {
      document.getElementById("test2").innerHTML += dto;
      window.test2ResultDisplayed = true;

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

Compare results of other browsers


Add a comment