[ -v8-dev; +v8-team ]

This change tanks our array builtin functions, because each [[Get]] call
needs to be preceded by a [[HasProperty]] call. I wrote an artificial
benchmark that measures the runtime of one of these builtins on a large
array. As expected the overall runtime doubles on my Z600 from
approximately 490us to 1050us. The solution would be to implement an
internal [[GetWithSentinel]] call, that returns an internal sentinel for
non-present elements instead of 'undefined', which could be an actual array
element. Of course we need to ensure that this sentinel never leaks to
application code.

function RunBench() {
  var a = new Array(10000);
  var cb = function(v, k, a) { return true; }
  a.every(cb);
}
var elapsed = 0;
var start = new Date();
for (var n = 0; elapsed < 2000; n++) {
  RunBench();
  elapsed = new Date() - start;
}
print('Time (array-every): ' + Math.floor(1000 * elapsed/n) + ' us.');

Fortunately for us, none of the public benchmarks seem to measure those
methods. These are the Golem numbers ...

http://nobel.aar/v8/r10721-v8-mstarzinger-issue-1790.html

Best regards,
Michael



On Fri, Feb 17, 2012 at 10:20, <[email protected]> wrote:

> Reviewers: rossberg,
>
> Description:
> Fix sequence of element access in array builtins.
>
> [email protected]
> BUG=v8:1790
> TEST=mjsunit/regress/regress-**1790,test262/15.4.4.22-9-9
>
>
> Please review this at 
> https://chromiumcodereview.**appspot.com/9419044/<https://chromiumcodereview.appspot.com/9419044/>
>
> SVN Base: 
> https://v8.googlecode.com/svn/**branches/bleeding_edge<https://v8.googlecode.com/svn/branches/bleeding_edge>
>
> Affected files:
>  M src/array.js
>  A test/mjsunit/regress/regress-**1790.js
>  M test/test262/test262.status
>
>
>

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

Reply via email to