Status: Untriaged
Owner: ----
New issue 4380 by [email protected]: 'Array' is slower than 'new Array'
https://code.google.com/p/v8/issues/detail?id=4380
According to the spec (6th ed.):
"When Array is called as a function rather than as a constructor, it also
creates and initializes a new Array object. Thus the function call
Array(...) is equivalent to the object creation expression new Array(...)
with the same arguments."
In dart2js we tried to use "Array" instead of "new Array" to reduce code
size, but it turns out they are not equivalent as far as optimization. The
difference between fast.js and slow.js (attached) is:
481c481
< var t1 = new G.Towers(new Array(3), 0);
---
var t1 = new G.Towers(Array(3), 0);
and the observed benchmark scores on IA32 (V8 built tip of tree today) are
fast: 180 us, slow: 480 us.
Details: slow deoptimizes repeatedly in dart.Towers.push$2 and eventually
stops optimizing it. The unoptimized dart.Towers.push$2 dominates the
profile.
Attachments:
fast.js 62.8 KB
slow.js 62.8 KB
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.