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>
class TestIntrinsicStringConcat {
constructor(prev) {
this.prev = prev;
}
run() {
let result = "";
for (let i = 0; i < len; i++) {
result += this.prev.charAt(i);
}
this.prev = result;
return result;
}
}
class TestTextDecoder {
constructor(prev, len) {
this.prev = prev;
this.buffer = new Uint16Array(len);
this.decoder = new TextDecoder("utf-16le");
}
run() {
for (let i = 0; i < len; i++) {
this.buffer[i] = this.prev.charCodeAt(i);
}
let result = this.decoder.decode(this.buffer);
this.prev = result;
return result;
}
}
let len = 1024;
let prev = "a".repeat(len);
let test_text_decoder = new TestTextDecoder(prev, len);
let test_intrinsic_string_concat = new TestIntrinsicStringConcat(prev);
let intrinsic_string_concat = () => {
return test_intrinsic_string_concat.run();
};
let decoder = new TextDecoder("utf-16le");
let textdecoder = () => {
return test_text_decoder.run();
};
</script>Ready to run.
| Test | Ops/sec | |
|---|---|---|
| intrinsic_string_concat | | ready |
| textdecoder | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.