string concat (len:32) (v7)

Revision 7 of this benchmark created on


Preparation HTML

<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 = 32;
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>

Test runner

Ready to run.

Testing in
TestOps/sec
intrinsic_string_concat
intrinsic_string_concat()
ready
textdecoder
textdecoder()
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.