Status: New
Owner: ----

New issue 2100 by wonchun: TypedArray length property access slow
http://code.google.com/p/v8/issues/detail?id=2100

Unlike plain arrays, typed array's length property seems very slow to access. In the attached repro, I have a loop that looks like this:

function normal(a) {
  var sum = 0;
  for (var i = 0; i < a.length; i++) {
    sum += a[i];
  }
  return sum;
}

With specialized versions for

[normal, typed] x
[array.length in loop, array.length hoisted to local]

On Firefox 11 you get the expected fastness:

normal: 41ms

normal_hoisted: 41ms

typed: 39ms

typed_hoisted: 39ms

On Chrome 19, typed is over 10x slower than typed_hoisted:

normal: 38ms

normal_hoisted: 37ms

typed: 406ms  <== !!!

typed_hoisted: 30ms

Attachments:
        array_length.html  1.3 KB

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to