jbqb-Element Creation

JavaScript performance comparison

Test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
    (function($, window, document) {
      "use strict";
   
      var elem, JB, CL, _mne;
   
      _mne = function(el) {
        return $(document.createElement(el));
      };
   
      elem = {
        div: 'div'
      };
   
      JB = {
        /**
         *
         * @param [classes]
         * @returns {jQuery}
         */

        div: function(classes) {
          return _mne(elem.div).addClass(classes || '');
        }
      };
   
      CL = {
        col12: 'columns large-12'
      };
   
      window.JB = JB;
      window.CL = CL;
   
    })(jQuery, window, document);
};
</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
Custom JBuilder
JB.div(CL.col12).appendTo($(document.body));
pending…
JQuery Way
$('<div/>').addClass(CL.col12).appendTo($(document.body));
pending…
Direct document
$(document.createElement('div')).addClass('columns large-12').appendTo($(document.body));
pending…

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

Compare results of other browsers

0 comments

Add a comment