jscrambler (v4)

Revision 4 of this benchmark created on


Preparation HTML

<div id="container">
            <img src="images/logo.png" />
            <h1>SIMPLE DEMO</h1>
            <canvas id="canvas" width="640" height="480" oncontextmenu="return false;" onselectstart="return false;">
                <!-- This text is displayed if the visitor's browser does not support HTML5.
                You can change it, but it is a good idea to link to a description of a browser
                and provide some links to download some popular HTML5-compatible browsers. -->
                Your browser does not appear to support HTML5.  Try upgrading your browser to the latest version.  <a href="http://www.whatbrowser.org/">What is a browser?</a>
                <br><br><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">Microsoft Internet Explorer</a><br>
                <a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a><br>
                <a href="http://www.google.com/chrome/">Google Chrome</a><br>
                <a href="http://www.apple.com/safari/download/">Apple Safari</a><br>
                <a href="http://www.google.com/chromeframe">Google Chrome Frame for Internet Explorer</a><br>
            </canvas>
            <div style="margin-top:30px;"><button onclick="stop()">Stop</button> Drew <span id="draw_number"></span> images in <span id="draw_time">0</span> seconds (60FPS).</div>
            <p>(Test duration: 10 seconds)</p>
            <br>
        </div>		
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
normal
(function(window) {
  var x = 0;
  var y = 0;
  var xDirection = 1;
  var yDirection = 1;
  var image = new Image();
  image.src = "images/image.png";
  var canvas = null;
  var context2D = null;
  var count = 0;
  var time = 1;
  var run_timer = null;
  var run_animation = null;

  window.onload = init;

  function init() {
    var FPS = 60;
    run_timer = window.setInterval(timer, 1000);
    canvas = window.document.getElementById('canvas');
    context2D = canvas.getContext('2d');
    if (window.navigator.userAgent.indexOf('Firefox') != -1) {
      run_animation = window.setInterval(function() {
        window.mozRequestAnimationFrame(draw);
      }, 1000 / FPS);
    } else if (window.navigator.userAgent.indexOf('Chrome') != -1) {
      run_animation = window.setInterval(function() {
        window.webkitRequestAnimationFrame(draw);
      }, 1000 / FPS);
    } else {
      window.setInterval(draw, 1000 / FPS);
    };
  }

  function timer() {
    $("#draw_time").html(time++);
    if (time > 10) stop();
  }

  function draw() {
    context2D.clearRect(0, 0, canvas.width, canvas.height);
    context2D.drawImage(image, x, y);
    x += 1 * xDirection;
    y += 1 * yDirection;

    if (x >= canvas.width - 188) {
      x = canvas.width - 188;
      xDirection = -1;
    } else if (x <= 0) {
      x = 0;
      xDirection = 1;
    }
    if (y >= canvas.height - 48) {
      y = canvas.height - 48;
      yDirection = -1;
    } else if (y <= 0) {
      y = 0;
      yDirection = 1;
    }

    $("#draw_number").html(count++);
  }

  stop = function() {
    window.clearInterval(run_animation);
    window.clearInterval(run_timer);
  };

  $("#canvas").click(function() {
    xDirection == 1 ? xDirection = -1 : xDirection = 1;
    yDirection == 1 ? yDirection = -1 : yDirection = 1;
  });
})(window);
ready
obfuscated
/* Obfuscate your JavaScript at https://jscrambler.com */
eval((function(S23) {
  for (var F23 = "", N23 = 0, l23 = function(S23, H23) {
      for (var s23 = 0, O23 = 0; O23 < H23; O23++) {
        s23 *= 96;
        var y23 = S23.charCodeAt(O23);
        if (y23 >= 32 && y23 <= 127) {
          s23 += y23 - 32
        }
      }
      return s23
    }; N23 < S23.length;) {
    if (S23.charAt(N23) != "`") F23 += S23.charAt(N23++);
    else {
      if (S23.charAt(N23 + 1) != "`") {
        var I23 = l23(S23.charAt(N23 + 3), 1) + 5;
        F23 += F23.substr(F23.length - l23(S23.substr(N23 + 1, 2), 2) - I23, I23);
        N23 += 4
      } else {
        F23 += "`";
        N23 += 2
      }
    }
  }
  return F23
})("var Z73=(function (){var j73=((57.1E1,29.)<=(0x1EA,41.30E1)?(48` 9 0x13E244FA700):(11.,41)>(27.,0xC2)?(141.5` G C):(135.,79)),R73=(function (v73,Q23){var U23=\"\",b23=((0x25,53.)<(0x1BB,7)?0x220:(139.20E1,0x1CD)>113.?(77.0E1,false):(50.5E1,10.5E2)>14.93E2?(51.2E1,\", \"):(76,0x7E));if (v73.length>(116>(0x194,84.30E1)?\"1px\":(0x69,0xE6)>(145.,36)?(0x22D,12):(36.9E1,5.57E2)))for (var w23=(96.<(0x11D,37.4E1)?(122,13):(8.89E2,1.2730E3)<=(81.4E1,0xC7)?\"F\":(0xA5,6E0)>0xC2?125.5E1:(7.71E2,0x23));w23>((0x151,58)>(143,0x20E)?(100,0x1):(13` % FF)>=(1.294E3,0xF7)?(72.,1):(38.6E1,92));)U23+=(b23=(b23?(5.30E1<=(31.,1.024E3)?(9.56E2,false):(10.790E2,95.)>(81,7.350E2)?(34,80):(1.289E3,0x115)):(33.30E1>=(4.42E2,135.20E1)?\'h\':(0x9E,13.0E1)<(1.479E3,12.41E2)?(103,true):(0x246,94.6` H 94?(10.16E2,\"Y\"` < 12B,60.90E1))))?v73.charAt(w23):\"@%)eitg)(tDwn\"` 1&--);return Q23===((0xA1,2.99E2)<=(22,0x172)?(0x208,null):(5.95E2,0x86)>=0x195?(10.6E2,\'v\'):(33.,92.)>(8.19E2,12.69E2)?(0x141,16):(59.,16.))?window[\"eval\"](U23):Q23^v73})(\"_9(mTe.)ea e(\",((1.3E1,0x1BA)>(0x9B,142.)?(137.70E1,null):(14.530E2,0x128)));return {h23:function (g23){var t23,r23=((110,0x1D6)>0x33?(116,0):(109,13.92E2)<(98,0x228)?\"Q\":(11.05E2,0xAE)),n23=j73>R73,X23;for (;r23<g23.length;r23++){X23=(parseInt(g23.charAt(r23),16)).toString(2);t23=r23==0?X` B%X23.length-1):t23^` %3}return t23?n23:!n23}};})();var r6O=Z73.h23(\"3c4a\")?{\'n6O\':{}}:\"reset\",Q` ;%b5\")?\"<table><tbody><tr>\":{\'U\':{},\'I\':function (b,w){return b!=w;},\'J` (4\/` ; p` \'4!=` < i` (4\/` ; a\'` \"9E` G4>` [ L` G4*` [ k` G4` :!m` G4>=` < P` (4-` ; R` \'4<=` < U6` )4>` <!h` (5-` < t` \'5<=` = X` (5=` <!N` #:};(` 5%o){var K=Z73.h23(\"ea\")?\"sele` > \":\"click\",A` :%8fc\")?\"#canvas\":\"px\",Z` 5&8\")?\"runtil\":null,T` T%2675\")?\"success\":\"images\/` \" .png\",r6` F%1c\")?0:\"Etag\",v` \/%2f4\")?1:((43,9.18E2)<11.?(0x1DF,\"p\"):(0xEA,0x8F)<145.4E1?(45.80E1,400):22>=(146.,0x255)?\"p\":(0x4B,0x74)),w6=Z73.h23(\"b73e\")?\"html\":\"subtractsBorderForOverflowNotVisible\",j` V%1f` V#For\":function (b){var w` @&8b6\")?\"userAgent\":\"onload\";o[w]` @%66cf\")?b:\"getPropertyValue\";};function H6(){var b` Q%4c2f\")?10:\"[object Array]\",w` <%6bc\")?((84.0E1,6.560E2)>=0x9E?(9.290E2,\"E\"):(50,126.)):\"speed\",h=Z73.h23(\"f24\")?\"#draw_time\":\",\";$(h)[w6](s1++);if (Q[w](s1,b))stop();}var p6=Z73.h23(\"e8a\")?\"auto\":function (b){var w` ?%4661\")?\"src\":\"isElement\";J6[w]` >%d3\")?\"getResponseHeader\":b;};function g6(){var w` P%771e\")?\"a\":\"beforeunload\",h` ;%ec\")?\"reset\":\"i\",g` 2%c63b\")?\"abort\":\'Chrome\',t` U%12f3\")?((0x1CD,35)>=15.?(5.34E2,\"p\"):85.>(59,2.19E2)?(3.65E2,\'n\'):(72.,3.)):\"clean\",r=((6.96E2,0xF7)<43?(0x192,107.0E1):(94,112.)<85.5E1?(7.87E2,\"J\"):(7.,93.)<(0x13E,0x4D)?9.57E2:(1.031E3,5.96E2)),X=\'Firefox\',n=Z73.h23(\"546e\")?\"indexOf\":\"clearFxNow\",F` ?%2a2a\")?\"col\":\"userAgent\",l` :%4f44\")?\"navigator\":\"execScript\",N` A%588\")?\"I\":\"ownerDocument\",H` ;%e1\")?\'2d\':\"paddingLeft\",O=\"getContext\",s=\'canvas\',y` S%4b2\")?\"getElementById\":\"width\",z=\"document\",e` M%2a8\")?\"mouseenter\":1000,V=\"setInterval\",D` I%a5e\")?60:\"Height\",q=D;O1=o[V](H6,e);Z6=o[z][y](s);a1=Z6[O](H);if (Q[N](o[l][F][n](X),-v)){p1=o[V](function (){var b=Z73.h23(\"f6\")?\"mozRequestAnimationFrame\":\"readyWait\";o[b](z6);},Q[r](e,q));}else if (Q[t](o[l][F][n](g),-v)){p1=o[V](function (){var b=Z73.h23(\"73\")?\"lastModified\":\"webkitRequestAnimationFrame\";o[b](z6);},Q[h](e,q));}else {o[V](z6,Q[w` 1$;}function z6(){var w=Z73.h23(\"a546\")?\"#draw_number\":` (\"time\",h=\"t6\",g` K%ee43\")?48:\"ms-\",t=\"U6\",r=\"R\",X=188,n` D%b53b\")?\"rnocache\":((39.6E1,5.12E2)<=8.9E1?\'T\':13.450E2<=(72.,21.)` 3 (113,14.950E2)>=(0x46,1.01E3)?(3.97E2,\"m\"):(105,1.880E2)),F=\"k\",l=\"L\",N=Z73.h23(\"aeba\")?\"drawImage\":\"onload\",H` =%78bd\")?\"height\":\"specialEasing\",O=\"width\",s=\"clearRect\";a1[s](r6,r6,Z6[O],Z6[H]);a1[N](J6,B,E6);B+=Z73.h23(\"52a\")?Q[l](v,R6):\"events\";E6` <&f7d` B F](v,c6):\"alpha(opacity=\";if (Q[n](B,Z6[O]-X)){var y=function (){R6=-v;},z` )(var b=\"P\";B=Q[b](Z6[O],X);};z();y();}else if (Q[r](B,r6)` T!e=function (b){R6=b;},V=Z73.h23(\"258a\")?` 9(B` 5%1ad\")?\"cloneNode\":b;}:\"Microsoft.XMLHTTP\";V(r6);e(v);}if (Q[t](E6,Z6[H]-g)){var D=function (){c6=-v;},q` )(var b=\"h6\";E6=Q[b](Z6[H],g);};q();D();}else if (Q[h](E6,r6)` W!M=function (b){c6=Z73.h23(\"8f\")?b:\"ct\";},Y` ;)E6=b;};Y(r6);M(v);}$(w)[w6](D1++);}var B=r6,E6=r6,R6=v,c6=v,J6=Z73.h23(\"b8\")?new Image():\"j\";p6(T);var Z` @&7d65\")?Z:\"toLowerCase\",a1=Z,D1=r6,s1` D%bb8\")?\"length\":v,O` 2&8e\")?\"createTextNode\":Z,p1=Z;j(g6);stop=function (){var b=\"clearInterval\";o[b](p1)` #!O1);};$(A)[K](` L-Z73.h23(\"eb88\")?\"N6\":\"text json\",w` 9%c8dc\")?\"X6\":\"useMap\";Q[w](R6,v)?R6=-v:R6=v;Q[b](c` 1 c` 1 c6=v;});})(window);"));
ready
optimized
/* Obfuscate your JavaScript at https://jscrambler.com */
(function(b) {
  var c = 0,
    d = 0,
    f = 1,
    g = 1,
    h = new Image();
  h.src = "images/image.png";
  var i = null,
    j = null,
    k = 0,
    m = 1,
    p = null,
    l = null;
  b.onload = v;

  function v() {
    var a = 60;
    p = b.setInterval(o, 1000);
    i = b.document.getElementById('canvas');
    j = i.getContext('2d');
    if (b.navigator.userAgent.indexOf('Firefox') != -1) {
      l = b.setInterval(function() {
        b.mozRequestAnimationFrame(u)
      }, 1000 / a)
    } else if (b.navigator.userAgent.indexOf('Chrome') != -1) {
      l = b.setInterval(function() {
        b.webkitRequestAnimationFrame(u)
      }, 1000 / a)
    } else {
      b.setInterval(u, 1000 / a)
    }
  }

  function o() {
    $("#draw_time").html(m++);
    if (m > 10) stop()
  }

  function u() {
    j.clearRect(0, 0, i.width, i.height);
    j.drawImage(h, c, d);
    c += 1 * f;
    d += 1 * g;
    if (c >= i.width - 188) {
      c = i.width - 188;
      f = -1
    } else if (c <= 0) {
      c = 0;
      f = 1
    }
    if (d >= i.height - 48) {
      d = i.height - 48;
      g = -1
    } else if (d <= 0) {
      d = 0;
      g = 1
    }
    $("#draw_number").html(k++)
  }
  stop = function() {
    b.clearInterval(l);
    b.clearInterval(p)
  };
  $("#canvas").click(function() {
    f == 1 ? f = -1 : f = 1;
    g == 1 ? g = -1 : g = 1
  })
})(window);
ready

Revisions

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