Status: New
Owner: ----
New issue 2452 by [email protected]: Array.shift extremely slow when
array has >= 128991 elements
http://code.google.com/p/v8/issues/detail?id=2452
A simple
```
while (a.length) a.shift();
```
gets horribly slow when the array contains 128991 elements or more.
For the attached (nodejs) benchmark, I get the following timings:
(This is with a x64 version of node)
```
node: 0.8.16
v8: 3.11.10.25
1000: 0.075ms
10000: 0.485ms
100000: 4.768ms
128990: 5.463ms
128991: 88732.009ms
```
Running this with a few --trace options yields no unexpected surprises:
```
# node --trace-opt --trace-deopt --trace-bailout --trace-gc index.js
[deoptimize context: 36e164b3fad1]
node: 0.8.16
v8: 3.11.10.25
[marking ConvertToString 0x36e164b47a20 for recompilation, reason: small
function, ICs with typeinfo: 0/2 (0%)]
Bailout in HGraphBuilder: @"ConvertToString": call to a JavaScript runtime
function
[disabled optimization for ConvertToString]
1000: 0.110ms
33 ms: Scavenge 2.5 (36.0) -> 2.2 (36.0) MB, 0 ms
[Runtime::PerformGC].
10000: 0.485ms
37 ms: Scavenge 2.4 (36.0) -> 2.3 (36.0) MB, 0 ms [allocation
failure].
[marking shiftFn 0x2977d0fdfea8 for recompilation, reason: hot and stable,
ICs with typeinfo: 2/2 (100%)]
[optimizing: shiftFn / 2977d0fdfea9 - took 0.566 ms]
100000: 4.831ms
44 ms: Scavenge 3.0 (37.0) -> 2.2 (37.0) MB, 0 ms
[Runtime::PerformGC].
46 ms: Scavenge 2.3 (37.0) -> 2.3 (37.0) MB, 0 ms [allocation
failure].
48 ms: Mark-sweep 2.3 (37.0) -> 2.0 (37.0) MB, 2 ms [last resort gc].
50 ms: Mark-sweep 2.0 (37.0) -> 2.0 (37.0) MB, 2 ms [last resort gc].
52 ms: Mark-sweep 2.0 (37.0) -> 2.0 (37.0) MB, 1 ms [last resort gc].
54 ms: Mark-sweep 2.0 (37.0) -> 2.0 (37.0) MB, 1 ms [last resort gc].
56 ms: Mark-sweep 2.0 (37.0) -> 2.0 (37.0) MB, 1 ms [last resort gc].
58 ms: Mark-sweep 2.0 (37.0) -> 1.9 (37.0) MB, 2 ms [last resort gc].
61 ms: Mark-sweep 1.9 (37.0) -> 1.9 (37.0) MB, 2 ms [last resort gc].
[marking shiftFn 0x2977d1f04120 for recompilation, reason: small function,
ICs with typeinfo: 2/2 (100%)]
[optimizing: shiftFn / 2977d1f04121 - took 0.117 ms]
128990: 5.459ms
71 ms: Scavenge 3.1 (38.0) -> 3.1 (38.0) MB, 0 ms [allocation
failure].
73 ms: Mark-sweep 3.1 (38.0) -> 2.0 (38.0) MB, 1 ms [last resort gc].
75 ms: Mark-sweep 2.0 (38.0) -> 2.0 (37.0) MB, 2 ms [last resort gc].
77 ms: Mark-sweep 2.0 (37.0) -> 2.0 (37.0) MB, 1 ms [last resort gc].
78 ms: Mark-sweep 2.0 (37.0) -> 2.0 (37.0) MB, 1 ms [last resort gc].
80 ms: Mark-sweep 2.0 (37.0) -> 2.0 (37.0) MB, 1 ms [last resort gc].
82 ms: Mark-sweep 2.0 (37.0) -> 1.9 (37.0) MB, 1 ms [last resort gc].
83 ms: Mark-sweep 1.9 (37.0) -> 1.9 (37.0) MB, 1 ms [last resort gc].
[marking shiftFn 0x2977d1f04120 for recompilation, reason: hot and stable,
ICs with typeinfo: 2/2 (100%)]
[optimizing: shiftFn / 2977d1f04121 - took 0.128 ms]
128991: 86261.991ms
```
Attachments:
index.js 623 bytes
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev