Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8075231

Typed array setters are very slow when index exceeds capacity

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u40
    • Fix Version/s: 8u60
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b10
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Typed array element setters are very slow when the index value is a valid index but exceeds the array capacity. This is because the setter throws an ArrayIndexOutOfBoundsException internally but does not propagate it (and thus does not cause relinking of fast array access).

        This makes the Octane gameboy benchmark in (older) revision v20 very slow. It can be reproduced with the following script:

        var buffer = new ArrayBuffer(16);
        var view = new Uint8Array(buffer);

        function bench() {
            var start = Date.now();

            for (var i = 0; i < 1000000; i++) {
                for (var j = 0; j < 18; j++) {
                    view[j] = 1;
                }
            }

            print("done: " + (Date.now() - start));
        }

        bench();

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  hannesw Hannes Wallnoefer
                  Reporter:
                  hannesw Hannes Wallnoefer
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: