jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase .
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2 Can be accessed at:
https://jsperf.app/negative-modulo/2 jquery html() vs replaceWith (v10) Revision 10 of this benchmark created by i.Nemiro on November 7, 2014 Preparation HTML <script src ="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" > </script >
<div id ="c1_ctl" >
<div id ="c1" class ="ui_widget" style ="display:inline-block; margin:0.2em;" > <div class ="ui-widget-header ui-corner-top" style ="width: 12em; padding: 0.2em;" > Rechnung Nr.: 2<span class ="ui-icon ui-icon-close" style ="float:right;" > </span > </div > <div class ="ui-widget-content ui-corner-bottom" style ="padding: 0.2em;" > <p > </p > <div style ="float:left; vertical-align:middle;" > <input type ="checkbox" > </div > <div style ="float:left;" > <div > Kunde: person2</div > <div > Preis: 2,2€</div > </div > <p > </p > </div > </div >
</div >
Teardown
jQuery ("#c1" ).replaceWith ('<div id="c1" class="ui_widget" style="display:inline-block; margin:0.2em;"> <div class="ui-widget-header ui-corner-top" style="width: 12em; padding: 0.2em;">Rechnung Nr.: 2<span class="ui-icon ui-icon-close" style="float:right;"></span> </div> <div class="ui-widget-content ui-corner-bottom" style="padding: 0.2em;"> <p> </p><div style="float:left; vertical-align:middle;"> <input type="checkbox"></div> <div style="float:left;"> <div>Kunde: person2</div> <div>Preis: 2,2€</div> </div> <p></p> </div> </div>' );
Test runner Ready to run.
Run Quick Run Testing in Test Ops/sec use .html() to replace the content of a wrapper jQuery ("#c1_ctl" ).html (
'<div class="ui_widget" style="display:inline-block; margin:0.2em;"> <div class="ui-widget-header ui-corner-top" style="width: 12em; padding: 0.2em;">Rechnung Nr.: 10<span class="ui-icon ui-icon-close" style="float:right;"></span> </div> <div class="ui-widget-content ui-corner-bottom" style="padding: 0.2em;"> <p> </p><div style="float:left; vertical-align:middle;"> <input type="checkbox"></div> <div style="float:left;"> <div>Kunde: person10</div> <div>Preis: 11€</div> </div> <p></p> </div> </div>'
);
ready
use .replaceWith() to replace the content jQuery ("#c1" ).replaceWith (
'<div class="ui_widget" style="display:inline-block; margin:0.2em;"> <div class="ui-widget-header ui-corner-top" style="width: 12em; padding: 0.2em;">Rechnung Nr.: 10<span class="ui-icon ui-icon-close" style="float:right;"></span> </div> <div class="ui-widget-content ui-corner-bottom" style="padding: 0.2em;"> <p> </p><div style="float:left; vertical-align:middle;"> <input type="checkbox"></div> <div style="float:left;"> <div>Kunde: person10</div> <div>Preis: 11€</div> </div> <p></p> </div> </div>'
);
ready
use appendChild var $c1 = jQuery ("#c1" );
jQuery (
'<div class="ui_widget" style="display:inline-block; margin:0.2em;"> <div class="ui-widget-header ui-corner-top" style="width: 12em; padding: 0.2em;">Rechnung Nr.: 10<span class="ui-icon ui-icon-close" style="float:right;"></span> </div> <div class="ui-widget-content ui-corner-bottom" style="padding: 0.2em;"> <p> </p><div style="float:left; vertical-align:middle;"> <input type="checkbox"></div> <div style="float:left;"> <div>Kunde: person10</div> <div>Preis: 11€</div> </div> <p></p> </div> </div>'
).insertBefore ($c1);
$c1.remove ();
ready
Revisions You can edit these tests or add more tests to this page by appending /edit to the URL.
Revision 1 : published on January 19, 2012 Revision 3 : published on August 13, 2013 Revision 4 : published on August 13, 2013 Revision 5 : published by Jonny Chen on January 15, 2014 Revision 6 : published on May 21, 2014 Revision 7 : published on May 21, 2014 Revision 8 : published on May 21, 2014 Revision 9 : published on June 24, 2014 Revision 10 : published by i.Nemiro on November 7, 2014 Revision 11 : published on March 12, 2015