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
Test which method is fastest to append multiple elements to DOM
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="content" style="display: none;">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>20</div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>30</div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>40</div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>50</div>
</div>
<div>
<h5>DocumentFragment</h5>
<div id="df-target"></div>
</div>
<div>
<h5>appendChild</h5>
<div id="appendchild-target"></div>
</div>
<div>
<h5>innerHTML</h5>
<div id="innerhtml-target"></div>
</div>
content = $('#content')[0];
innerHtml = content.innerHTML;
df = document.createDocumentFragment();
dfTarget = $('#df-target')[0];
appendChildTarget = $('#appendchild-target')[0];
innerHtmlTarget = $('#innerhtml-target')[0];
Ready to run.
Test | Ops/sec | |
---|---|---|
documentFragment |
| ready |
appendChild |
| ready |
innerHTML |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.