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
<script>
String.prototype.supplant = function(o) {
return this.replace(/{([^{}]*)}/g, function(a, b) {
var r = o[b];
return typeof r === 'string' || typeof r === 'number' ? r : a;
});
};
var template = '<tr><td>{title}</td><td>{type}</td><td><a href="tags/{tag}">{tag}</a></td><td>{created_at}</td></tr>';
var data = {
title: 'title',
type: 'type',
tag: 'tag',
created_at: 'created_at'
};
function pic(template) {
template = template.replace(/[\n'\\]/g, '\\$&');
template = template.replace(/\{(\w*)\}/g, function(str, key) {
return "'+d['" + key + "']+'";
});
return new Function("d", "return '" + template + "'");
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Template |
| ready |
Concatenation |
| ready |
Array join |
| ready |
Pic |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.