redactor init

Benchmark created on


Description

Obviously, initializing the redactor over the DOM will be slower than just building DOM elements. The question is - how much slower? How does the number of DOM elements effect this process? Is it Linear?

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="http://imperavi.com/js/redactor/redactor.js">
</script>
<div id="all">
</div>

Setup

var iDomElements = 1000;
    var $all = $('all');
    var text = 'This is a text place holder. Here you better write something about your company, like when was it founded and by who. In order to edit this text, you can either double click here and start typing using your keyboard, or you can click on the text once in order to edit the text in the right edit menu.';

Test runner

Ready to run.

Testing in
TestOps/sec
just dom
for (var i = 0; i < iDomElements; i++) {
  $all.append('<div id="item_' + i + '" class="yoyo">' + text + '</div>');
}

for (var i = 0; i < iDomElements; i++) {
  var $item = $('#item_' + i);
}
ready
with redactor
for (var i = 0; i < iDomElements; i++) {
  $all.append('<div id="item_' + i + '" class="yoyo">' + text + '</div>');
}

for (var i = 0; i < iDomElements; i++) {
  var $item = $('#item_' + i);
  $item.redactor();
}
ready

Revisions

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