string concat

Benchmark created on


Preparation HTML

    <script>
      let len = 1024;

      let buffer = new Uint16Array(len);

      let ch = "a";
      let ch_code = ch.charCodeAt(0);

      let intrinsic_string_concat = () => {
        let result = "";
        for (let i = 0; i < len; i++) {
          result += ch;
        }
        result.length;
        return result;
      };

      let decoder = new TextDecoder("utf-16le");

      let textdecoder = () => {
        for (let i = 0; i < len; i++) {
          buffer[i] = ch_code;
        }
        let result = decoder.decode(buffer);
		result.length;
        return result;
      };
    </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.