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
This is a test case to find whether it is more efficient to traverse the DOM to find the related values, pull them directly from the element as attributes, or to parse JSON from a single attribute.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="1" class="process-container">
<div>
<h3>Test H3</h3>
<p>Address</p>
</div>
<div id="2" class="task-data">
<table>
<thead>
<tr>
<td>
<h4>
List
</h4>
</td>
<td>
<span>Completed</span>
</td>
</tr>
</thead>
<tbody>
<tr>
<td class="first">
<div class="task-container">
<input type="checkbox" id="taskGuid" value="someGuid" name="${TaskId}" />
<label for="taskGuid" class="task">Task Name</label>
<div class="functions">
<a href="#" class="function-view-file">
<span class="sprite sprite-view-icon" />
View
</a>
<a href="#" id="testLink" data-task-id="3" class="function-note"><span class="sprite sprite-note-icon" />Note</a>
</div>
<ol class="notes">
</ol>
</div>
</td>
<td class="date-completed">
<span>
--
</span>
</td>
</tr>
</tbody>
<tfoot></tfoot>
</table>
</div>
<div id="task-data-placeholder"></div>
</div>
<script>
var $testLink = $('#testLink');
var json = '{"processID": 1, "unitID": 2, "taskID": 3}';
$testLink.data('processID', 1);
$testLink.data('unitID', 2);
$testLink.data('taskID', 3);
$testLink.attr('data-json2', json);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Data |
| ready |
JSON |
| ready |
DOM Traversal |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.