Closed Bug 610063 Opened 14 years ago Closed 14 years ago

Port "dense array" work from TT

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stejohns, Assigned: stejohns)

Details

(Whiteboard: PACMAN)

Attachments

(1 file, 6 obsolete files)

in Tamarin-Tracing, we experimented with an approach used in SpiderMonkey to improve array performance: assume most arrays are "mostly" dense, and allocate contiguous storage for them even if not 100% dense, falling back to a hashtable approach only if a certain threshold of sparseness is met. In most cases this is reputed to provide better performance (as well as better memory usage).

See https://bugzilla.mozilla.org/show_bug.cgi?id=412813 for the original TT work.
Assignee: nobody → stejohns
This patch started out simply: in order to simply the "dense array" work, I wanted to remove the "friend" access that ArrayClass had, so that all knowledge of the innards of ArrayObject was kept internal.

My change turned into serious scope creep, as I decided that the best way to do this was to change the affected methods (concat, splice, shift, reverse, pop) to be implemented as virtual methods based in ScriptObject, with overrides in ArrayObject... once I had done that I decided that it was more sensible to move everything else to mimic that as well, as several of them may also be more amenable to Array-specific optimization once true dense arrays are in place (eg indexOf), and this pattern will make that easier...

One the one hand it's definitely a case of premature optimization, but on the other hand it's arguably cleaner code now.

(Note that I left "sort" using the old pattern, though, as it would have required moving a huge chunk of code.)
Attachment #488618 - Flags: review?(lhansen)
Hm, I thought we already had an open bug on this topic...  No matter.  I will try to review the patch this week but other items are unfortuately higher priority.
(In reply to comment #2)
> Hm, I thought we already had an open bug on this topic...  

I searched for one but could not find one that was relevant to TR.

I may find a different reviewer if anyone else has substantially more bandwidth, but this is not a high-priority review.
I'd like to put a hold on this patch until the tamarin parts of the exactgc work land.  I'm in continual rebasing hell because of the recent and sweeping list, array, and vector changes and I'd like to get out of it as soon as I can.  (These deep changes are all good for the code base but they create a lot of trouble for me.)
(In reply to comment #4)
> I'd like to put a hold on this patch until the tamarin parts of the exactgc
> work land. 

Not a problem -- I'm going to continue to poke at it but won't plan on landing it anytime soon. (Review on your part would still be welcome, at your convenience...)
Attached patch Prototype of dense arrays (obsolete) — Splinter Review
Here's a prototype patch that works and passes acceptance tests; unfortunately, it's not a performance win. The only places I'm seeing performances gains are benches that had known issue with growing dense arrays downward (a known limitation of the existing code); in particular, boidshack is +10% and gameoflife is %25%... but a lot of other benches are off in the -3% to -5% range. More investigation needed to figure out why. Archiving this patch here for now.
Attachment #489264 - Flags: feedback?(edwsmith)
Comment on attachment 489264 [details] [diff] [review]
Prototype of dense arrays

(In reply to comment #6)

> The only places I'm seeing performances gains are
> benches that had known issue with growing dense arrays downward (a known
> limitation of the existing code); in particular, boidshack is +10% and
> gameoflife is %25%...

That's really the only place I'd expect to see a win, so, great (and i hapilly disagree that the patch isn't a win).  The regressions need looking into, assuming they're outside the noise range (obviously).

The other thing to hand-check is to see if the common access paths are any shorter, or if they could be made any shorter within the scope of this patch.  Ideally, the expression (x = a[i]) would only involve a null pointer check on a, a dense check, a range check on I, and a load.  Writing down the access path by hand could uncover something.  My favorite way is looking at assembly code in gdb, but YMMV.

> if (m_type == kDense && isDenseIndex(index))

at the risk of cleverness, could the dense range encode "not dense" (say, m_denseUsed == 0), and avoid the m_type load-and-compare?  (maybe m_denseUsed == -1 means kSealed, so we can tell the difference between sparse and sealed on the slow path?)
Attachment #489264 - Flags: feedback?(edwsmith) → feedback+
I found some subtle errors that are causing us to revert to to sparse arrays much more frequently, but there are still other regressions. I'll keep poking as I have time and post a new patch when I get more info.
another gotcha is that we were reverting to sparse if there were any non-numeric properties, meaning that all "arguments" were sparse due to the "callee" property.
(In reply to comment #7)
> at the risk of cleverness, could the dense range encode "not dense" (say,
> m_denseUsed == 0), and avoid the m_type load-and-compare? 

I like it, but m_denseStart is even better since we have to use it anyway... stand by for a new patch.
Attached patch Faster prototype (obsolete) — Splinter Review
This uses m_denseStart as a sentinel field to avoid unnecessary dense-vs-sparse checks, plus some other streamlining, to eliminate the performance regressions... we still get the wins on grow-down cases, but many other benches are often now in the +3% or more range, with almost no regressions. (numbers to be posted subsequently)

In fact, I think this is almost review-worthy; the main things that need fiddling with are:
-- more testing, including memory load testing and perf testing on non-x86
-- integration with Flash/AIR to see if I changed anything they happened to rely on
-- the trick used here relies on having dense arrays only when no numeric properties are > 0x7fffffff; I think this is correctly checked everywhere but there might be pathologies in concat, splice, etc that could allow for such a thing to happen; need to construct specific test cases to look for this
Attachment #489264 - Attachment is obsolete: true
Attachment #489711 - Flags: feedback?(edwsmith)
Results from tests on MacTel32 below. Contrary to my previous statement, most results are in the noise range (on my machine, anything +- 1% is noise). I'll run longer tests overnight.


                                      avm          avm2
test                          best    avg   best    avg  %dBst  %dAvg
Metric: time 
Dir: misc/
  boids                       1951   1959   1840 1847.3    5.7    5.7 ++
  boidshack                    502  505.7    446  447.3   11.2   11.5 ++
  gameoflife                  2470 2475.3   1814 1817.3   26.6   26.6 ++
  primes                      5156 5174.7   5155 5164.3    0.0    0.2   
Dir: scimark/
  FFT                         2280 2282.7   2312   2315   -1.4   -1.4 - 
  LU                          3085 3090.3   3029 3035.3    1.8    1.8 + 
  MonteCarlo                  2752 2757.7   2717 2733.7    1.3    0.9 + 
  SOR                         2531 2535.3   2568 2573.7   -1.5   -1.5 - 
  SparseCompRow                102  102.3     99   99.3    2.9    2.9 + 
Dir: jsbench/
  Crypt                       3837 3847.7   3802   3805    0.9    1.1 + 
  Euler                       7433 7465.7   7210 7240.7    3.0    3.0 + 
  FFT                         7057 7168.3   7084   7103   -0.4    0.9   
  HeapSort                    3537 3556.7   3585 3596.7   -1.4   -1.1 - 
  LUFact                      5869   5879   5791   5802    1.3    1.3 + 
  Moldyn                      9971  10004  10010 10039.3   -0.4   -0.4   
  RayTracer                   7088   7110   7080 7103.3    0.1    0.1   
  SOR                        32555  32752  32598  32665   -0.1    0.3   
  Series                      8907 8917.7   9005 9047.3   -1.1   -1.5 - 
  SparseMatmult              10411  10497  10322 10428.3    0.9    0.7   
Dir: jsbench/typed/
  Crypt                        965  965.7    965  966.3      0   -0.1   
  Euler                       9192   9247   9108   9153    0.9    1.0 + 
  FFT                         1577   1587   1626 1629.7   -3.1   -2.7 - 
  HeapSort                    1373   1378   1391 1393.7   -1.3   -1.1 - 
  LUFact                      1327 1335.7   1332 1339.3   -0.4   -0.3   
  Moldyn                      4554 4559.3   4545 4560.3    0.2   -0.0   
  RayTracer                   1348 1352.3   1351 1351.7   -0.2    0.0   
  SOR                         4472 4476.7   4467 4487.3    0.1   -0.2   
  Series                      7704 7730.7   7701 7717.7    0.0    0.2   
  SparseMatmult               2644 2671.7   2644   2664      0    0.3   
Dir: v8/
  crypto                       448    448    444  442.7   -0.9   -1.2 - 
  deltablue                   1553   1551   1549 1531.7   -0.3   -1.2   
  earley-boyer                1009   1002   1005    989   -0.4   -1.3   
  raytrace                    2903   2881   2891   2873   -0.4   -0.3   
  richards                    1001 1000.3    973    972   -2.8   -2.8 - 
Dir: v8/typed/
  crypto                       466  463.3    455  452.3   -2.4   -2.4 - 
  deltablue                   2422 2420.7   2439 2429.3    0.7    0.4 + 
  earley-boyer                1002    998   1008   1002    0.6    0.4   
  raytrace                    6157 6148.3   6249   6173    1.5    0.4 + 
  richards                    1854   1847   1859   1847    0.3      0   
Dir: v8.5/js/
  crypto                       397  392.3    394  390.7   -0.8   -0.4   
  deltablue                    304    304    299  298.3   -1.6   -1.9 - 
  earley-boyer                1005  998.7   1001  999.7   -0.4    0.1   
  raytrace                     648    647    658  656.7    1.5    1.5 + 
  regexp                      87.3   87.1   88.2   88.1    1.0    1.1 + 
  richards                     244  242.3    243    240   -0.4   -1.0   
  splay                        738    737    749  747.3    1.5    1.4 + 
Dir: v8.5/optimized/
  crypto                      3544   3536   3536   3531   -0.2   -0.1   
  deltablue                   2991 2972.3   3116 3098.7    4.2    4.3 + 
  earley-boyer                 992    976    995  989.3    0.3    1.4   
  raytrace                    7525   7505   7488 7376.7   -0.5   -1.7   
  regexp                      87.5   86.8   88.5   88.5    1.1    1.9 + 
  richards                    3703   3693   3731 3698.3    0.8    0.1   
  splay                       5443   5406   5520 5477.7    1.4    1.3 + 
Dir: v8.5/typed/
  crypto                      2736   2734   2752 2748.7    0.6    0.5 + 
  deltablue                   3265 3257.3   3214 3208.7   -1.6   -1.5 - 
  earley-boyer                1003    993   1001    998   -0.2    0.5   
  raytrace                    7525 7522.3   7466   7400   -0.8   -1.6   
  regexp                      87.3   87.2   88.9   88.7    1.8    1.7 + 
  richards                    3707 3704.3   3739   3739    0.9    0.9 + 
  splay                        921    919    933  925.7    1.3    0.7 + 
Dir: v8.5/untyped/
  crypto                       439    439    436  435.3   -0.7   -0.8 - 
  deltablue                   1598 1597.7   1605 1604.7    0.4    0.4 + 
  earley-boyer                1003 1000.3    994    986   -0.9   -1.4   
  raytrace                    3109   3103   3118   3112    0.3    0.3   
  regexp                      87.6   87.5   88.7   88.6    1.3    1.3 + 
  richards                     387  386.3    391  387.3    1.0    0.3 + 
  splay                        875    874    886    884    1.3    1.1 +
Results from overnight run, 32 and 64 are below. On the whole, a few real positives, a lot of stuff in the noise range and a few meaningful regressions that need investigating.


stevoquad:tl stejohns$ sudo nice -n -20 ../rperf-test.sh ../tr 5
Password:


Tamarin tests started: 2010-11-10 18:16:46.748911
Executing 460 test(s)
avm: /Users/stejohns/tamdev/tr/platform/mac/avmshell/build/Release/avm  version: cyclone
avm2: /Users/stejohns/tamdev/tl/platform/mac/avmshell/build/Release/avm  version: cyclone
iterations: 5

                                      avm          avm2
test                          best    avg   best    avg  %dBst  %dAvg
Metric: iterations/second 
Dir: asmicro/
  alloc-1                       37     37     37     37      0      0   
  alloc-10                      13     13     14   13.8    7.7    6.2 ++
  alloc-11                      12     12     12     12      0      0   
  alloc-12                       8      8     12     12     50     50 ++
  alloc-13                      84   83.4     83     83   -1.2   -0.5 - 
  alloc-14                      69   68.8     69   68.8      0      0   
  alloc-2                       19     19     19     19      0      0   
  alloc-3                       15     15     16     16    6.7    6.7 ++
  alloc-4                       42     42     42     42      0      0   
  alloc-5                       29   28.2     29     29      0    2.8   
  alloc-6                       67   66.6     67     67      0    0.6   
  alloc-7                       38     38     38     38      0      0   
  alloc-8                       15     15     15     15      0      0   
  alloc-9                       15     15     15     15      0      0   
  arguments-1                  676  674.2    675  674.4   -0.1    0.0   
  arguments-2                  371  370.6    375    374    1.1    0.9 + 
  arguments-3                   19     19     19   18.8      0   -1.1   
  arguments-4                   26     26     26     26      0      0   
  array-1                     1473 1471.6   1611 1610.2    9.4    9.4 ++
  array-2                      500  497.4    532  531.4    6.4    6.8 ++
  array-pop-1                  304  301.2    286  283.8   -5.9   -5.8 --
  array-push-1                 251  250.2    254    254    1.2    1.5 + 
  array-shift-1                131  130.6    156  154.6   19.1   18.4 ++
  array-slice-1                 17     17     17   16.4      0   -3.5   
  array-sort-1                  25     25     24     24     -4     -4 - 
  array-sort-2                   2      2      2      2      0      0   
  array-sort-3                  20   19.2     20     20      0    4.2   
  array-sort-4                   9      9      9      9      0      0   
  array-unshift-1              147  146.6    153    152    4.1    3.7 + 
  closedvar-read-1            3634   3626   3607   3605   -0.7   -0.6 - 
  closedvar-write-1           4431 4391.4   4001 3982.8   -9.7   -9.3 --
  closedvar-write-2           4743   4670   4557 4483.4   -3.9   -4.0 - 
  do-1                        3594 3590.6   3594 3591.6      0    0.0   
  for-1                       3588 3585.4   3589   3585    0.0   -0.0   
  for-2                       2189 2188.4   2191 2189.4    0.1    0.0 + 
  for-3                       2289   2287   2291 2288.8    0.1    0.1   
  for-in-1                     339    339    326    326   -3.8   -3.8 - 
  for-in-2                     140  139.4    312  311.6  122.9  123.5 ++
  funcall-1                    321  320.2    321  320.4      0    0.1   
  funcall-2                    210    210    210    210      0      0   
  funcall-3                    296  295.4    300    300    1.4    1.6 + 
  funcall-4                    103    103    101    101   -1.9   -1.9 - 
  globalvar-read-1            3615 3612.6   3602 3598.6   -0.4   -0.4 - 
  globalvar-write-1           4685 4680.2   4313   4288   -7.9   -8.4 --
  isNaN-1                     3415   3409   3563 3559.2    4.3    4.4 + 
  isNaN-2                     3592 3583.8   3591 3588.2   -0.0    0.1   
  isNaN-3                     3314 3277.2   3167 3165.2   -4.4   -3.4 - 
  lookup-array-fetch-1         690  689.4    701    701    1.6    1.7 + 
  lookup-array-in-1           1517 1513.2   1528 1521.8    0.7    0.6 + 
  lookup-negindex-array-1      404  403.2    401  400.6   -0.7   -0.6 - 
  lookup-negindex-array-2      348  347.8    344  343.2   -1.1   -1.3 - 
  lookup-negindex-object-1     417    417    416    416   -0.2   -0.2   
  lookup-negindex-object-2     392  391.6    392  391.2      0   -0.1   
  lookup-object-fetch-1        787  786.8    788  787.4    0.1    0.1 + 
  lookup-object-in-1          1358 1356.2   1358   1357      0    0.1   
  number-toString-1              5      5      5      5      0      0   
  number-toString-2             66     66     65     65   -1.5   -1.5 - 
  oop-1                          3      3      3      3      0      0   
  parseFloat-1                  64   63.8     66     66    3.1    3.4 + 
  parseInt-1                   159    159    159    159      0      0   
  regex-exec-1                  62     62     63   62.4    1.6    0.6 + 
  regex-exec-2                  73   72.4     74     74    1.4    2.2 + 
  regex-exec-3                 104    104    106    106    1.9    1.9 + 
  regex-exec-4                 284    283    285  284.4    0.4    0.5   
  restarg-1                    676  675.2    675  674.4   -0.1   -0.1 - 
  restarg-2                    398  397.6    398    398      0    0.1   
  restarg-3                     34   33.4     33     33   -2.9   -1.2 - 
  restarg-4                     26     26     26     26      0      0   
  string-casechange-1           23     23     23   22.2      0   -3.5   
  string-casechange-2           22     22     23     23    4.5    4.5 + 
  string-charAt-1             1291 1290.4   1291 1290.6      0    0.0   
  string-charAt-2               75     75     74     74   -1.3   -1.3 - 
  string-charCodeAt-1         1372 1371.4   1369   1368   -0.2   -0.2 - 
  string-charCodeAt-2         1283 1282.6   1283 1281.8      0   -0.1   
  string-charCodeAt-3         1029 1027.8   1025 1024.6   -0.4   -0.3 - 
  string-charCodeAt-4         1732 1730.2   1731 1728.6   -0.1   -0.1   
  string-charCodeAt-5          864  863.2    864  863.4      0    0.0   
  string-charCodeAt-6         1372 1371.2   1368 1367.4   -0.3   -0.3 - 
  string-charCodeAt-7         1731 1730.6   1732 1730.4    0.1   -0.0   
  string-fromCharCode-1        288    288    287  286.6   -0.3   -0.5 - 
  string-fromCharCode-2         59     59     57     57   -3.4   -3.4 - 
  string-indexOf-1             202  201.2    191  190.6   -5.4   -5.3 --
  string-indexOf-2             114    114    114    114      0      0   
  string-indexOf-3             103    103    103    103      0      0   
  string-lastIndexOf-1         461    461    461    461      0      0   
  string-lastIndexOf-2         148  147.4    148  145.6      0   -1.2   
  string-lastIndexOf-3       142.7  142.1  142.6  142.3   -0.1    0.1   
  string-slice-1               112  111.8    111    111   -0.9   -0.7 - 
  string-split-1                 8      8      8      8      0      0   
  string-split-2                 8      8      8      8      0      0   
  string-substring-1           120  119.6    119  118.4   -0.8   -1.0 - 
  switch-1                     701  700.6    700    700   -0.1   -0.1 - 
  switch-2                      98     98     98     98      0      0   
  switch-3                     172    172    172    172      0      0   
  try-1                        219    219    219    219      0      0   
  try-2                         14     14     14     14      0      0   
  try-3                         46     46     45     45   -2.2   -2.2 - 
  vector-push-1                 40     40     39     39   -2.5   -2.5 - 
  while-1                     3590 3588.6   3586   3584   -0.1   -0.1 - 
Metric: time 
Dir: jsbench/
  Crypt                       3831   3833   3788   3793    1.1    1.0 + 
  Euler                       7410 7412.4   7178 7181.4    3.1    3.1 + 
  FFT                         7230 7245.8   7019 7085.4    2.9    2.2 + 
  HeapSort                    3532   3533   3574 3576.4   -1.2   -1.2 - 
  LUFact                      5884 5888.4   5742 5743.8    2.4    2.5 + 
  Moldyn                     10003 10018.4   9965 10018.6    0.4   -0.0   
  RayTracer                   7071   7082   7090 7113.8   -0.3   -0.4   
  SOR                        32615 32652.4  32178 32232.6    1.3    1.3 + 
  Series                      8900 8903.4   8933 8938.2   -0.4   -0.4 - 
  SparseMatmult              10318 10330.6  10186 10242.6    1.3    0.9 + 
Dir: jsbench/typed/
  Crypt                        963  964.2    965    966   -0.2   -0.2 - 
  Euler                       9150 9158.8   9047   9062    1.1    1.1 + 
  FFT                         1563 1564.8   1558   1560    0.3    0.3 + 
  HeapSort                    1369 1369.6   1382 1383.6   -0.9   -1.0 - 
  LUFact                      1317   1318   1322 1323.6   -0.4   -0.4 - 
  Moldyn                      4519 4526.8   4499 4523.8    0.4    0.1 + 
  RayTracer                   1346 1346.6   1349 1349.4   -0.2   -0.2 - 
  SOR                         4445 4447.8   4442 4450.2    0.1   -0.1   
  Series                      7688   7690   7680   7686    0.1    0.1   
  SparseMatmult               2640 2640.6   2640 2647.8      0   -0.3   
Metric: iterations/second 
Dir: jsmicro/
  alloc-1                       37   36.4     36     36   -2.7   -1.1 - 
  alloc-10                      13     13     13     13      0      0   
  alloc-11                      11     11     11     11      0      0   
  alloc-12                       7      7     11     11   57.1   57.1 ++
  alloc-13                      71     71     72     72    1.4    1.4 + 
  alloc-14                      61   60.6     62   61.4    1.6    1.3   
  alloc-2                       19     19     19     19      0      0   
  alloc-3                       15     15     16     16    6.7    6.7 ++
  alloc-4                       42     42     41     41   -2.4   -2.4 - 
  alloc-5                       29   28.4     29   28.8      0    1.4   
  alloc-6                       58     58     59     59    1.7    1.7 + 
  alloc-7                       37     37     37     37      0      0   
  alloc-8                       14     14     14     14      0      0   
  alloc-9                       14     14     14     14      0      0   
  arguments-1                  147    147    147    147      0      0   
  arguments-2                  104    104    104    104      0      0   
  arguments-3                   17     17     17     17      0      0   
  array-1                      372    372    382  381.8    2.7    2.6 + 
  array-2                      283    283    260    260   -8.1   -8.1 --
  array-pop-1                   61   60.8     64   63.2    4.9    3.9 + 
  array-push-1                  41     41     42     42    2.4    2.4 + 
  array-shift-1                 52     52     58     58   11.5   11.5 ++
  array-slice-1                 14     14     14     14      0      0   
  array-sort-1                  23     23     23     23      0      0   
  array-sort-2                   2      2      2      2      0      0   
  array-sort-3                  20   19.6     20   19.8      0    1.0   
  array-sort-4                   9      9      9      9      0      0   
  array-unshift-1               21     21     12     12  -42.9  -42.9 --
  closedvar-read-1             603  602.2    612  610.8    1.5    1.4 + 
  closedvar-write-1            443    442    443    442      0      0   
  closedvar-write-2            441  438.8    440  439.4   -0.2    0.1   
  do-1                         609    609    610  609.4    0.2    0.1 + 
  for-1                        602  601.8    602    602      0    0.0   
  for-2                        185    185    185    185      0      0   
  for-3                        135    135    135    135      0      0   
  for-in-1                     268    268    260  259.2   -3.0   -3.3 - 
  for-in-2                     129  128.6    251    251   94.6   95.2 ++
  funcall-1                    208    208    208    208      0      0   
  funcall-2                    203    203    203    203      0      0   
  funcall-3                    200  199.6    200    200      0    0.2   
  funcall-4                   1332 1330.6   1331 1329.6   -0.1   -0.1   
  globalvar-read-1             600  599.6    600  599.4      0   -0.0   
  globalvar-write-1            430  429.8    430  429.4      0   -0.1   
  isNaN-1                      518    518    518  517.6      0   -0.1   
  lookup-array-fetch-1         602  601.8    599  597.6   -0.5   -0.7 - 
  lookup-array-in-1            990  989.2    984  982.4   -0.6   -0.7 - 
  lookup-object-fetch-1        674    674    680    678    0.9    0.6 + 
  lookup-object-in-1           887  886.2    882    882   -0.6   -0.5 - 
  number-toString-1              5      5      5      5      0      0   
  number-toString-2             54     54     55     55    1.9    1.9 + 
  oop-1                          3      3      3      3      0      0   
  parseFloat-1                  48     48     50     50    4.2    4.2 + 
  parseInt-1                   112    112    111    111   -0.9   -0.9   
  regex-exec-1                  55   54.8     56     56    1.8    2.2 + 
  regex-exec-2                  68   67.2     69     69    1.5    2.7 + 
  regex-exec-3                  95   94.4     96   95.6    1.1    1.3 + 
  regex-exec-4                 235  233.8    239  238.4    1.7    2.0 + 
  string-casechange-1           15     15     15     15      0      0   
  string-casechange-2           15     15     15     15      0      0   
  string-charAt-1               97     97     97     97      0      0   
  string-charAt-2               43     43     42     42   -2.3   -2.3 - 
  string-charCodeAt-1           88   87.4     88     88      0    0.7   
  string-charCodeAt-2           89     89     88   87.6   -1.1   -1.6 - 
  string-fromCharCode-1         74     74     73     73   -1.4   -1.4 - 
  string-fromCharCode-2         37     37     36     36   -2.7   -2.7 - 
  string-fromCharCode-3         66   65.8     65   64.4   -1.5   -2.1 - 
  string-fromCharCode-4         69     69     68     68   -1.4   -1.4 - 
  string-indexOf-1              79     79     78     78   -1.3   -1.3 - 
  string-indexOf-2              51     51     51     51      0      0   
  string-indexOf-3              49     49     49     49      0      0   
  string-lastIndexOf-1          79     79     79     79      0      0   
  string-lastIndexOf-2          57   56.6     57     57      0    0.7   
  string-lastIndexOf-3          73     73     75     75    2.7    2.7 + 
  string-slice-1                47     47     47     47      0      0   
  string-split-1                 7      7      7      7      0      0   
  string-split-2                 7      7      7      7      0      0   
  string-substring-1            50     50     50   49.4      0   -1.2   
  switch-1                     109    109    109    109      0      0   
  switch-2                      55     55     55     55      0      0   
  switch-3                      68   67.2     68   67.2      0      0   
  try-1                        144  143.2    143    143   -0.7   -0.1 - 
  try-2                         14     14     14     14      0      0   
  try-3                         35     35     35   34.2      0   -2.3   
  while-1                      602    602    603  602.2    0.2    0.0 + 
Metric: time 
Dir: language/describetype/
  desctypeperf                 603  603.6    593  593.8    1.7    1.6 + 
Dir: language/e4x/
  addingToXMLList               18   18.8     19     19   -5.6   -1.1 --
  appendChildAndString          53   53.4     53   53.6      0   -0.4   
concatenatingStringsFromE4X      7    7.2      7    7.2      0      0   
  simpleStringConcatenation      1    1.8      1    1.8      0      0   
  usingAppendChildAndE4X        54   54.8     54   54.8      0      0   
Dir: language/string/
  append_concat                 82     82     81     81    1.2    1.2 + 
  append_equal_plus             67   68.2     66   66.4    1.5    2.6   
  append_plus_equal             67   67.6     66   66.6    1.5    1.5   
  charAt                       174  174.6    174  174.2      0    0.2   
  charCodeAt                   205  206.2    204  204.2    0.5    1.0   
  indexOf                      302  302.8    303    303   -0.3   -0.1 - 
  lastIndexOf                  208    208    208    208      0      0   
  replace                      518  518.8    533    539   -2.9   -3.9 - 
  replace2                     822  822.8    817  817.4    0.6    0.7 + 
  search                        35   35.6     35   35.2      0    1.1   
  slice                        277  277.8    278  278.2   -0.4   -0.1   
  split                        333  333.8    328  329.6    1.5    1.3 + 
  static_ascii_array_100       976  976.4    251  251.8   74.3   74.2 ++
  static_ascii_array_50        961  961.6    232  233.6   75.9   75.7 ++
  static_latin1_array_100     1917 1922.6    473  474.8   75.3   75.3 ++
  static_latin1_array_50       961    961    237  237.8   75.3   75.3 ++
  substr                       203  203.6    204  204.4   -0.5   -0.4 - 
  substring                    193  193.6    194  194.2   -0.5   -0.3 - 
Dir: language/string/typed/
  append_concat                 73   73.8     72   72.4    1.4    1.9 + 
  append_equal_plus             61   61.4     61   61.4      0      0   
  append_plus_equal             62   62.2     61   61.4    1.6    1.3 + 
  charAt                        10     11     11   11.6    -10   -5.5 - 
  charCodeAt                    10   10.6     10     11      0   -3.8   
  indexOf                      302  302.4    303    303   -0.3   -0.2 - 
  lastIndexOf                  207  207.8    208    208   -0.5   -0.1 - 
  replace                      517    518    519    525   -0.4   -1.4   
  replace2                     824  824.4    819    820    0.6    0.5 + 
  search                        35   35.4     35   35.4      0      0   
  slice                        182  182.2    183  183.6   -0.5   -0.8 - 
  split                        334  334.6    332  332.8    0.6    0.5 + 
  substr                       144    144    144  144.2      0   -0.1   
  substring                    126  126.6    127  127.4   -0.8   -0.6 - 
Dir: misc/
  boids                       1938 1938.2   1833 1834.2    5.4    5.4 ++
  boidshack                    497  498.2    445    446   10.5   10.5 ++
  gameoflife                  2463 2464.2   1807 1808.2   26.6   26.6 ++
  primes                      5147 5148.2   5143 5145.4    0.1    0.1 + 
Dir: mmgc/
  gcbench                     2934   2938   2929 2939.8    0.2   -0.1   
  ofib-rc                      269  269.8    269  269.4      0    0.1   
  ofib                        1180 1200.8   1217 1232.6   -3.1   -2.6 - 
  sfib                         377    377    374  374.2    0.8    0.7 + 
Dir: scimark/
  FFT                         2270   2276   2304 2308.6   -1.5   -1.4 - 
  LU                          3064   3066   3019 3019.6    1.5    1.5 + 
  MonteCarlo                  2747 2748.2   2711   2715    1.3    1.2 + 
  SOR                         2523 2524.4   2558 2560.8   -1.4   -1.4 - 
  SparseCompRow                101  101.8     99   99.2    2.0    2.6 + 
Dir: sunspider/
  access-binary-trees           33   33.6     33   33.8      0   -0.6   
  access-fannkuch               87     87     82   82.4    5.7    5.3 ++
  access-nbody                  84     84     83     84    1.2      0   
  access-nsieve                 44   44.4     26     26   40.9   41.4 ++
  bitops-3bit-bits-in-byte      10   10.2     10   10.4      0   -2.0   
  bitops-bits-in-byte           29   29.8     29   29.8      0      0   
  bitops-bitwise-and           210    210    209  209.8    0.5    0.1 + 
  bitops-nsieve-bits            41   41.6     41     41      0    1.4   
  controlflow-recursive         15   15.2     15     15      0    1.3   
  crypto-aes                    41   41.8     41   41.4      0    1.0   
  crypto-md5                    20     20     19   19.4      5    3.0 + 
  crypto-sha1                   19   19.8     20     20   -5.3   -1.0 --
  date-format-tofte            171  177.2    171  179.4      0   -1.2   
  math-cordic                   54     54     54   54.4      0   -0.7   
  math-partial-sums            193    193    194  194.4   -0.5   -0.7 - 
  math-spectral-norm            28     28     27   27.8    3.6    0.7 + 
  s3d-cube                      69     70     68   68.6    1.4    2.0   
  s3d-morph                     41   41.2     41   41.4      0   -0.5   
  s3d-raytrace                  79     79     78   78.8    1.3    0.3 + 
  string-fasta                  81   81.4     87     87   -7.4   -6.9 --
  string-unpack-code           171    171    170    170    0.6    0.6   
  string-validate-input         43   43.4     43   43.6      0   -0.5   
Dir: sunspider/as3/
  access-binary-trees            9      9      9    9.2      0   -2.2   
  access-fannkuch               56     56     49   49.8   12.5   11.1 ++
  access-nbody                   6    6.4      6    6.4      0      0   
  access-nsieve                 33     33     14     14   57.6   57.6 ++
  bitops-3bit-bits-in-byte       5    5.8      5    5.8      0      0   
  bitops-bits-in-byte            9    9.2      9    9.2      0      0   
  bitops-bitwise-and             2      2      2    2.4      0  -20.0   
  bitops-nsieve-bits            27     27     27     27      0      0   
  controlflow-recursive          4      4      4      4      0      0   
  crypto-aes                    31   31.4     31   31.8      0   -1.3   
  crypto-md5                    24   24.2     23   23.6    4.2    2.5 + 
  crypto-sha1                   18   18.6     18   18.8      0   -1.1   
  date-format-tofte            164  168.2    163    168    0.6    0.1   
  math-cordic                   14     14     13   13.6    7.1    2.9 + 
  math-partial-sums             65     66     66   66.2   -1.5   -0.3   
  math-spectral-norm             5    5.8      5    5.4      0    6.9   
  s3d-cube                      21     21     20   20.6    4.8    1.9 + 
  s3d-morph                     29   29.4     29     29      0    1.4   
  s3d-raytrace                  32   32.8     32   32.6      0    0.6   
  string-fasta                  40     40     40     40      0      0   
  string-unpack-code           169  169.2    169  169.2      0      0   
  string-validate-input         33     33     33     33      0      0   
Dir: sunspider/as3vector/
  access-fannkuch               22   22.6     22   22.2      0    1.8   
  access-nbody                   6      6      6      6      0      0   
  access-nsieve                 12     12     11   11.8    8.3    1.7 ++
  bitops-nsieve-bits             8      8      8      8      0      0   
  math-cordic                   14     14     14     14      0      0   
  math-spectral-norm            16   16.4     16   16.2      0    1.2   
  s3d-cube                      16   16.8     16   16.6      0    1.2   
  s3d-morph                     16   16.2     16   16.4      0   -1.2   
  string-fasta                  43     43     42   42.2    2.3    1.9 + 
  string-validate-input         35     35     35   35.2      0   -0.6   
Dir: sunspider-0.9.1/js/
  access-binary-trees           33     33     33     33      0      0   
  access-fannkuch               85   85.6     81   81.2    4.7    5.1 + 
  access-nbody                  78   78.2     78     78      0    0.3   
  access-nsieve                 42   42.6     25     25   40.5   41.3 ++
  bitops-3bit-bits-in-byte       8    8.4      9      9  -12.5   -7.1 --
  bitops-bits-in-byte           29   29.2     29   29.4      0   -0.7   
  bitops-bitwise-and           210  210.6    209  209.8    0.5    0.4 + 
  bitops-nsieve-bits            40     40     39   39.6    2.5    1.0 + 
  controlflow-recursive         15     15     14   14.6    6.7    2.7 + 
  crypto-aes                    35   35.2     35   35.6      0   -1.1   
  crypto-md5                    16     16     16     16      0      0   
  crypto-sha1                   18     18     17   17.6    5.6    2.2 + 
  math-cordic                   52   52.6     52     52      0    1.1   
  math-partial-sums            194  194.6    196    196   -1.0   -0.7 - 
  math-spectral-norm            27   27.8     27   27.8      0      0   
  regexp-dna                   826  829.6    825  827.6    0.1    0.2   
  s3d-cube                      62   62.4     61   61.8    1.6    1.0 + 
  s3d-morph                     57   57.4     57   57.6      0   -0.3   
  s3d-raytrace                  72   72.2     71   71.4    1.4    1.1 + 
  string-fasta                  56   56.4     57   57.2   -1.8   -1.4 - 
  string-unpack-code          4386   4402   4399   4433   -0.3   -0.7   
  string-validate-input         42     42     42     42      0      0   
Dir: sunspider-0.9.1/typed/
  access-binary-trees            8    8.6      8    8.2      0    4.7   
  access-fannkuch               57   57.8     53     53    7.0    8.3 ++
  access-nbody                   4      4      4    4.2      0   -5.0   
  access-nsieve                 30     30     12     12     60     60 ++
  bitops-3bit-bits-in-byte       5      5      5      5      0      0   
  bitops-bits-in-byte            8    8.8      8    8.8      0      0   
  bitops-bitwise-and             2      2      2      2      0      0   
  bitops-nsieve-bits            26     26     25   25.6    3.8    1.5 + 
  controlflow-recursive          3    3.6      3    3.6      0      0   
  crypto-aes                    26     26     26   26.2      0   -0.8   
  crypto-md5                     4    4.4      4    4.2      0    4.5   
  crypto-sha1                    4    4.4      4    4.2      0    4.5   
  math-cordic                   12   12.6     12   12.4      0    1.6   
  math-partial-sums             11   11.4     11     11      0    3.5   
  math-spectral-norm             8      8      7    7.8   12.5    2.5 ++
  regexp-dna                   795  816.4    794    800    0.1    2.0   
  s3d-cube                      17   17.6     17   17.2      0    2.3   
  s3d-morph                     47   47.4     46     47    2.1    0.8   
  s3d-raytrace                   8    8.6      8    8.6      0      0   
  string-fasta                  31     31     31   31.4      0   -1.3   
  string-unpack-code          4373 4393.8   4380   4487   -0.2   -2.1   
  string-validate-input         26   26.2     26   26.6      0   -1.5   
Metric: v8 custom v8 normalized metric (hardcoded in the test)
Dir: v8/
  crypto                       450  449.6    445    444   -1.1   -1.2 - 
  deltablue                   1557 1555.8   1553 1550.4   -0.3   -0.3 - 
  earley-boyer                1018 1011.8   1012 1007.4   -0.6   -0.4   
  raytrace                    2909   2906   2900 2894.4   -0.3   -0.4 - 
  richards                    1002 1001.4    978  977.2   -2.4   -2.4 - 
Dir: v8/typed/
  crypto                       467  466.4    456  455.4   -2.4   -2.4 - 
  deltablue                   2434 2432.4   2439 2438.4    0.2    0.2 + 
  earley-boyer                1019 1014.8   1012 1008.6   -0.7   -0.6 - 
  raytrace                    6224   6213   6317   6312    1.5    1.6 + 
  richards                    1858 1856.4   1866 1864.4    0.4    0.4 + 
Dir: v8.5/js/
  crypto                       399    399    398  397.8   -0.3   -0.3 - 
  deltablue                    305  304.6    300  299.2   -1.6   -1.8 - 
  earley-boyer                1012 1011.2   1010 1004.2   -0.2   -0.7   
  raytrace                     650  649.4    659  658.8    1.4    1.4 + 
  regexp                      87.3   87.2   88.5   88.2    1.4    1.2 + 
  richards                     245    245    244    244   -0.4   -0.4   
  splay                        742  736.2    753  752.2    1.5    2.2 + 
Dir: v8.5/optimized/
  crypto                      3558 3556.8   3560 3558.2    0.1    0.0 + 
  deltablue                   3013 3010.6   3136 3134.8    4.1    4.1 + 
  earley-boyer                1006 1001.2   1005 1001.2   -0.1      0   
  raytrace                    7547 7535.2   7502 7492.2   -0.6   -0.6 - 
  regexp                      87.7   87.4   88.9   88.5    1.4    1.3 + 
  richards                    3715 3714.2   3739 3737.4    0.6    0.6 + 
  splay                       5522 5489.8   5532 5494.6    0.2    0.1   
Dir: v8.5/typed/
  crypto                      2746 2744.8   2756 2754.2    0.4    0.3 + 
  deltablue                   3265   3265   3214 3212.2   -1.6   -1.6 - 
  earley-boyer                1005   1002   1004   1002   -0.1      0   
  raytrace                    7540 7527.8   7495 7481.6   -0.6   -0.6 - 
  regexp                      87.6   87.4   88.8   88.6    1.4    1.3 + 
  richards                    3719 3716.6   3747 3742.2    0.8    0.7 + 
  splay                        921    921    937  934.6    1.7    1.5 + 
Dir: v8.5/untyped/
  crypto                       440  439.2    437    436   -0.7   -0.7 - 
  deltablue                   1604 1601.4   1609   1607    0.3    0.3 + 
  earley-boyer                1007 1001.8   1004 1000.2   -0.3   -0.2   
  raytrace                    3112 3108.4   3124 3119.2    0.4    0.3 + 
  regexp                      87.8   87.7   89.1   88.9    1.5    1.5 + 
  richards                     387  385.6    391  388.4    1.0    0.7 + 
  splay                        877  871.6    888  879.4    1.3    0.9   





Tamarin tests started: 2010-11-10 19:32:54.387210
Executing 460 test(s)
avm: /Users/stejohns/tamdev/tr/platform/mac/avmshell/build/Release64/avm  version: cyclone
avm2: /Users/stejohns/tamdev/tl/platform/mac/avmshell/build/Release64/avm  version: cyclone
iterations: 5

                                      avm          avm2
test                          best    avg   best    avg  %dBst  %dAvg
Metric: iterations/second 
Dir: asmicro/
  alloc-1                       41     41     41     41      0      0   
  alloc-10                      12     12     12     12      0      0   
  alloc-11                      13     13     12     12   -7.7   -7.7 --
  alloc-12                       9      9     12     12   33.3   33.3 ++
  alloc-13                     100    100    101    101      1      1   
  alloc-14                      78     78     78     78      0      0   
  alloc-2                       22     22     23   22.8    4.5    3.6 + 
  alloc-3                       11     11     11     11      0      0   
  alloc-4                       51     51     48     48   -5.9   -5.9 --
  alloc-5                       38   37.8     37     37   -2.6   -2.1 - 
  alloc-6                       77     77     78     78    1.3    1.3 + 
  alloc-7                       43     43     43     43      0      0   
  alloc-8                       14   13.2     14   13.8      0    4.5   
  alloc-9                       14   13.4     14   13.8      0    3.0   
  arguments-1                  925    924    924    924   -0.1      0 - 
  arguments-2                  489    489    490  489.4    0.2    0.1 + 
  arguments-3                   22     22     22     22      0      0   
  arguments-4                   30     30     30     30      0      0   
  array-1                     2108 2106.6   2292 2290.8    8.7    8.7 ++
  array-2                      657  656.8    674    674    2.6    2.6 + 
  array-pop-1                  435  429.4    367    364  -15.6  -15.2 --
  array-push-1                 287    287    306  305.8    6.6    6.6 ++
  array-shift-1                133  132.6    150  148.8   12.8   12.2 ++
  array-slice-1                 20     20     20   19.8      0   -1.0   
  array-sort-1                  31     31     31     31      0      0   
  array-sort-2                   2      2      2      2      0      0   
  array-sort-3                  23     23     23     23      0      0   
  array-sort-4                  11     11     11     11      0      0   
  array-unshift-1              140    140    143  142.4    2.1    1.7 + 
  closedvar-read-1            4081   4079   4072 4069.8   -0.2   -0.2 - 
  closedvar-write-1           4189 4185.8   4194 4190.2    0.1    0.1 + 
  closedvar-write-2           4193   4192   4195 4191.2    0.0   -0.0   
  do-1                        4193 4191.6   4195 4193.6    0.0    0.0   
  for-1                       3595   3593   3598 3594.2    0.1    0.0   
  for-2                       2291 2289.8   2292 2290.2    0.0    0.0   
  for-3                       2291 2289.2   2292 2290.6    0.0    0.1   
  for-in-1                     408  407.8    390  389.8   -4.4   -4.4 - 
  for-in-2                     188    188    362    362   92.6   92.6 ++
  funcall-1                    384    384    388  387.6    1.0    0.9 + 
  funcall-2                    290  289.2    283    283   -2.4   -2.1 - 
  funcall-3                    345    345    342    342   -0.9   -0.9   
  funcall-4                    114    114    115  114.4    0.9    0.4 + 
  globalvar-read-1            3602 3599.6   3600 3597.2   -0.1   -0.1   
  globalvar-write-1           4188 4175.2   4179 4146.8   -0.2   -0.7   
  isNaN-1                     2987 2984.8   2987 2985.4      0    0.0   
  isNaN-2                     3478 3475.6   3480 3477.8    0.1    0.1   
  isNaN-3                     3578   3575   3573 3565.8   -0.1   -0.3   
  lookup-array-fetch-1         740  739.4    735  734.8   -0.7   -0.6 - 
  lookup-array-in-1           1551 1550.4   1572 1570.4    1.4    1.3 + 
  lookup-negindex-array-1      415  412.4    413  409.6   -0.5   -0.7   
  lookup-negindex-array-2      330    330    330  329.8      0   -0.1   
  lookup-negindex-object-1     424  421.8    423  420.8   -0.2   -0.2   
  lookup-negindex-object-2     364  363.8    366  365.2    0.5    0.4 + 
  lookup-object-fetch-1        841  840.4    831  830.8   -1.2   -1.1 - 
  lookup-object-in-1          1438 1437.4   1420   1419   -1.3   -1.3 - 
  number-toString-1              7      7      7      7      0      0   
  number-toString-2             84     84     85   84.6    1.2    0.7 + 
  oop-1                          3      3      4      4   33.3   33.3 ++
  parseFloat-1                  77     77     77     77      0      0   
  parseInt-1                   174  173.6    178    178    2.3    2.5 + 
  regex-exec-1                  77     77     70   69.6   -9.1   -9.6 --
  regex-exec-2                  94     94     89     89   -5.3   -5.3 --
  regex-exec-3                 122    122    119  118.2   -2.5   -3.1 - 
  regex-exec-4                 374    374    355  353.8   -5.1   -5.4 --
  restarg-1                    924  923.2    924    924      0    0.1   
  restarg-2                    514    514    514    514      0      0   
  restarg-3                     40     40     38     38     -5     -5 - 
  restarg-4                     31   30.2     30     30   -3.2   -0.7 - 
  string-casechange-1           31     31     31   30.4      0   -1.9   
  string-casechange-2           31     31     30     30   -3.2   -3.2 - 
  string-charAt-1             1524   1523   1525 1524.6    0.1    0.1   
  string-charAt-2               89     89     90     90    1.1    1.1 + 
  string-charCodeAt-1         1901 1900.6   1901 1900.6      0      0   
  string-charCodeAt-2         1710 1704.8   1722 1707.2    0.7    0.1   
  string-charCodeAt-3         1248 1247.6   1249   1248    0.1    0.0   
  string-charCodeAt-4         2025 2024.4   2026   2025    0.0    0.0   
  string-charCodeAt-5         1134 1132.8   1134 1133.2      0    0.0   
  string-charCodeAt-6         1901 1899.6   1901 1900.6      0    0.1   
  string-charCodeAt-7         1979 1977.4   1980 1979.4    0.1    0.1   
  string-fromCharCode-1        276  266.2    356  342.6   29.0   28.7 ++
  string-fromCharCode-2         68     68     68     68      0      0   
  string-indexOf-1             277  276.8    271    271   -2.2   -2.1 - 
  string-indexOf-2             150    150    150    150      0      0   
  string-indexOf-3             108    108    108    108      0      0   
  string-lastIndexOf-1         682  681.2    682  681.6      0    0.1   
  string-lastIndexOf-2         152  151.8    152  151.6      0   -0.1   
  string-lastIndexOf-3       156.8  156.8  156.8  156.8      0      0   
  string-slice-1               135    135    135    135      0      0   
  string-split-1                 8      8      8      8      0      0   
  string-split-2                 8      8      8      8      0      0   
  string-substring-1           147    147    147  146.8      0   -0.1   
  switch-1                     742  741.4    742  741.8      0    0.1   
  switch-2                     118  117.2    117    117   -0.8   -0.2 - 
  switch-3                     221    221    221    221      0      0   
  try-1                        284    284    285    285    0.4    0.4   
  try-2                         14     14     14     14      0      0   
  try-3                         59     59     59     59      0      0   
  vector-push-1                 51     51     52   51.8    2.0    1.6 + 
  while-1                     3595 3593.6   3596 3592.6    0.0   -0.0   
Metric: time 
Dir: jsbench/
  Crypt                       3264 3266.6   3233 3234.4    0.9    1.0 + 
  Euler                       5956   5971   5760 5772.6    3.3    3.3 + 
  FFT                         6697 6710.6   6633 6639.2    1.0    1.1 + 
  HeapSort                    2988 2989.2   2938 2939.6    1.7    1.7 + 
  LUFact                      5264 5274.8   5155 5164.6    2.1    2.1 + 
  Moldyn                      8875 8889.2   8879 8887.2   -0.0    0.0   
  RayTracer                   5975 5979.4   5992 5997.2   -0.3   -0.3 - 
  SOR                        28363 28372.8  28249 28267.2    0.4    0.4 + 
  Series                      8159 8167.6   7889 7896.6    3.3    3.3 + 
  SparseMatmult               9341 9371.4   9216 9242.6    1.3    1.4 + 
Dir: jsbench/typed/
  Crypt                        902  903.2    901  903.6    0.1   -0.0   
  Euler                       6774 6792.4   6770 6818.6    0.1   -0.4   
  FFT                         1450 1451.4   1356 1357.4    6.5    6.5 ++
  HeapSort                    1103   1110   1155 1199.2   -4.7   -8.0   
  LUFact                      1046 1047.6   1049 1052.4   -0.3   -0.5   
  Moldyn                      3552   3557   3538 3545.8    0.4    0.3 + 
  RayTracer                   1061   1062   1067 1068.2   -0.6   -0.6 - 
  SOR                         3492   3495   3480 3486.2    0.3    0.3 + 
  Series                      6614 6633.2   6362 6378.8    3.8    3.8 + 
  SparseMatmult               2004 2005.4   2003 2008.6    0.0   -0.2   
Metric: iterations/second 
Dir: jsmicro/
  alloc-1                       39     39     39     39      0      0   
  alloc-10                      12     12     12   11.8      0   -1.7   
  alloc-11                      12     12     12   11.6      0   -3.3   
  alloc-12                       8      8     12   11.6     50   45.0 ++
  alloc-13                      87     87     88   87.4    1.1    0.5 + 
  alloc-14                      69     69     70     70    1.4    1.4 + 
  alloc-2                       22     22     22     22      0      0   
  alloc-3                       10     10     11   10.8     10    8.0 ++
  alloc-4                       49     49     46     46   -6.1   -6.1 --
  alloc-5                       37     37     36     36   -2.7   -2.7 - 
  alloc-6                       69   68.4     69     69      0    0.9   
  alloc-7                       43     43     43     43      0      0   
  alloc-8                       13     13     13     13      0      0   
  alloc-9                       13     13     13     13      0      0   
  arguments-1                  173    173    170  169.2   -1.7   -2.2 - 
  arguments-2                  100    100    102    102      2      2 + 
  arguments-3                   19     19     19     19      0      0   
  array-1                      408    408    415    415    1.7    1.7 + 
  array-2                      286    286    291  290.8    1.7    1.7 + 
  array-pop-1                   73   72.2     79   78.4    8.2    8.6 ++
  array-push-1                  52   51.8     53   52.8    1.9    1.9 + 
  array-shift-1                 58     58     62     62    6.9    6.9 ++
  array-slice-1                 17     17     17     17      0      0   
  array-sort-1                  30   29.4     29     29   -3.3   -1.4 - 
  array-sort-2                   2      2      2      2      0      0   
  array-sort-3                  23     23     23     23      0      0   
  array-sort-4                  11     11     11     11      0      0   
  array-unshift-1               23     23     14     14  -39.1  -39.1 --
  closedvar-read-1             647  646.6    647    647      0    0.1   
  closedvar-write-1            476  475.8    476    476      0    0.0   
  closedvar-write-2            476  475.8    476    476      0    0.0   
  do-1                         682  681.8    682  681.2      0   -0.1   
  for-1                        664  663.8    664    664      0    0.0   
  for-2                        192    192    202  201.6    5.2    5.0 ++
  for-3                        149    149    147    147   -1.3   -1.3 - 
  for-in-1                     299    299    287  286.8   -4.0   -4.1 - 
  for-in-2                     156    156    272  271.8   74.4   74.2 ++
  funcall-1                    266    266    265  264.8   -0.4   -0.5 - 
  funcall-2                    247    247    250  249.8    1.2    1.1 + 
  funcall-3                    235  234.6    238  237.2    1.3    1.1 + 
  funcall-4                   1648 1647.6   1643   1642   -0.3   -0.3 - 
  globalvar-read-1             647  646.8    647  646.4      0   -0.1   
  globalvar-write-1            476    476    476    476      0      0   
  isNaN-1                      476    476    476    476      0      0   
  lookup-array-fetch-1         650  649.2    647    647   -0.5   -0.3 - 
  lookup-array-in-1           1032 1030.8   1029   1028   -0.3   -0.3 - 
  lookup-object-fetch-1        726    726    716  715.4   -1.4   -1.5 - 
  lookup-object-in-1           945  944.4    941  939.8   -0.4   -0.5 - 
  number-toString-1              7      7      7      7      0      0   
  number-toString-2             66     66     66     66      0      0   
  oop-1                          3      3      3      3      0      0   
  parseFloat-1                  58   57.6     57     57   -1.7   -1.0 - 
  parseInt-1                   126    126    126    126      0      0   
  regex-exec-1                  63     63     58     58   -7.9   -7.9 --
  regex-exec-2                  79   78.4     79   78.4      0      0   
  regex-exec-3                 106  105.2    105  104.2   -0.9   -1.0 - 
  regex-exec-4                 277  276.4    276  274.8   -0.4   -0.6   
  string-casechange-1           20     20     20     20      0      0   
  string-casechange-2           20     20     20     20      0      0   
  string-charAt-1              116    116    114  113.2   -1.7   -2.4 - 
  string-charAt-2               51     51     51     51      0      0   
  string-charCodeAt-1          111    111    106    106   -4.5   -4.5 - 
  string-charCodeAt-2          108  107.8    103    103   -4.6   -4.5 - 
  string-fromCharCode-1         91     91     91     91      0      0   
  string-fromCharCode-2         44     44     44     44      0      0   
  string-fromCharCode-3         81     81     81     81      0      0   
  string-fromCharCode-4         85     85     86     86    1.2    1.2 + 
  string-indexOf-1              95     95     98     98    3.2    3.2 + 
  string-indexOf-2              64     64     65     65    1.6    1.6 + 
  string-indexOf-3              55     55     56     56    1.8    1.8 + 
  string-lastIndexOf-1          97     97     99     99    2.1    2.1 + 
  string-lastIndexOf-2          65   64.4     66     66    1.5    2.5 + 
  string-lastIndexOf-3          92     92     94     94    2.2    2.2 + 
  string-slice-1                60     60     60     60      0      0   
  string-split-1                 8      8      8      8      0      0   
  string-split-2                 8      8      8      8      0      0   
  string-substring-1            60     60     60     60      0      0   
  switch-1                     116    116    116    116      0      0   
  switch-2                      64     64     64     64      0      0   
  switch-3                      89     89     89     89      0      0   
  try-1                        187  182.2    195    195    4.3    7.0 + 
  try-2                         14   13.8     14     14      0    1.4   
  try-3                         48     48     48     48      0      0   
  while-1                      664  663.6    664  663.6      0      0   
Metric: time 
Dir: language/describetype/
  desctypeperf                 569  572.6    571  572.4   -0.4    0.0   
Dir: language/e4x/
  addingToXMLList               16     16     17     17   -6.2   -6.2 --
  appendChildAndString          45   45.6     46   46.2   -2.2   -1.3 - 
concatenatingStringsFromE4X      5    5.4      6      6    -20  -11.1 --
  simpleStringConcatenation      1    1.4      1    1.6      0  -14.3   
  usingAppendChildAndE4X        47   47.8     47   47.6      0    0.4   
Dir: language/string/
  append_concat                 69   69.2     68   68.2    1.4    1.4 + 
  append_equal_plus             58   58.4     57   57.2    1.7    2.1 + 
  append_plus_equal             58   58.2     57   57.6    1.7    1.0 + 
  charAt                       130  130.2    130  130.2      0      0   
  charCodeAt                   149  149.4    149  149.4      0      0   
  indexOf                      302    302    302  302.4      0   -0.1   
  lastIndexOf                  207    208    208    208   -0.5      0 - 
  replace                      397  399.8    400  400.6   -0.8   -0.2 - 
  replace2                     745  746.4    847    849  -13.7  -13.7 --
  search                        35   35.6     35   35.4      0    0.6   
  slice                        207  208.4    206  206.8    0.5    0.8   
  split                        440  441.2    442    446   -0.5   -1.1   
  static_ascii_array_100       847  852.2    268  269.4   68.4   68.4 ++
  static_ascii_array_50        832  832.8    249  250.6   70.1   69.9 ++
  static_latin1_array_100     1676 1678.2    514  515.8   69.3   69.3 ++
  static_latin1_array_50       838  839.2    257  257.8   69.3   69.3 ++
  substr                       154    154    153    153    0.6    0.6   
  substring                    147  147.6    148    148   -0.7   -0.3 - 
Dir: language/string/typed/
  append_concat                 64   64.4     63   63.4    1.6    1.6 + 
  append_equal_plus             52     53     52   52.8      0    0.4   
  append_plus_equal             53   53.2     52   52.6    1.9    1.1   
  charAt                        11     11     11   11.4      0   -3.6   
  charCodeAt                    11   11.4     11   11.4      0      0   
  indexOf                      302    302    301  301.4    0.3    0.2 + 
  lastIndexOf                  207  207.6    207  207.6      0      0   
  replace                      391  395.2    396    397   -1.3   -0.5 - 
  replace2                     747  750.2    847  847.8  -13.4  -13.0 --
  search                        35   35.6     35     35      0    1.7   
  slice                        144  144.4    144  144.2      0    0.1   
  split                        440  440.8    424    443    3.6   -0.5 + 
  substr                       105  105.8    105  105.8      0      0   
  substring                     96     96     96   96.2      0   -0.2   
Dir: misc/
  boids                       1503   1504   1517 1517.4   -0.9   -0.9 - 
  boidshack                    418  419.4    375  376.8   10.3   10.2 ++
  gameoflife                  1830 1831.6   1278   1280   30.2   30.1 ++
  primes                      4826   4827   4828 4829.6   -0.0   -0.1   
Dir: mmgc/
  gcbench                     2532   2605   2638 2640.8   -4.2   -1.4 - 
  ofib-rc                      289  292.4    359    362  -24.2  -23.8 --
  ofib                        1191 1194.2   1178 1189.2    1.1    0.4   
  sfib                         315  315.2    312  312.6    1.0    0.8 + 
Dir: scimark/
  FFT                         1654 1656.2   1639 1639.4    0.9    1.0 + 
  LU                          2546   2547   2505 2507.6    1.6    1.5 + 
  MonteCarlo                  1582   1597   1534   1548    3.0    3.1 + 
  SOR                         1832 1833.6   1839 1841.4   -0.4   -0.4 - 
  SparseCompRow                 88   88.6     84   84.4    4.5    4.7 + 
Dir: sunspider/
  access-binary-trees           30     30     29   29.6    3.3    1.3 + 
  access-fannkuch               72     72     66   66.4    8.3    7.8 ++
  access-nbody                  65   65.2     65   66.2      0   -1.5   
  access-nsieve                 42   42.4     25   25.8   40.5   39.2 ++
  bitops-3bit-bits-in-byte       8    8.2      8      8      0    2.4   
  bitops-bits-in-byte           22   22.6     23     24   -4.5   -6.2   
  bitops-bitwise-and           183  183.2    180  180.8    1.6    1.3 + 
  bitops-nsieve-bits            26   26.6     26     26      0    2.3   
  controlflow-recursive         13     13     13   13.4      0   -3.1   
  crypto-aes                    34     34     34     34      0      0   
  crypto-md5                    13   13.4     13   13.6      0   -1.5   
  crypto-sha1                   11   11.6     12     12   -9.1   -3.4 --
  date-format-tofte            208  212.2    207  210.8    0.5    0.7   
  math-cordic                   45   45.2     45   45.6      0   -0.9   
  math-partial-sums            172    172    174    174   -1.2   -1.2 - 
  math-spectral-norm            22   22.4     22   22.2      0    0.9   
  s3d-cube                      59   59.4     59   59.4      0      0   
  s3d-morph                     38   38.6     37   37.8    2.6    2.1 + 
  s3d-raytrace                  65   65.8     65     65      0    1.2   
  string-fasta                  78   78.8     79     79   -1.3   -0.3 - 
  string-unpack-code           119  119.6    119    119      0    0.5   
  string-validate-input         39   39.4     38     38    2.6    3.6 + 
Dir: sunspider/as3/
  access-binary-trees            7    7.8      8      8  -14.3   -2.6 --
  access-fannkuch               43     43     37     37   14.0   14.0 ++
  access-nbody                   5    5.6      5    5.2      0    7.1   
  access-nsieve                 31   31.8     15     15   51.6   52.8 ++
  bitops-3bit-bits-in-byte       4    4.4      4    4.4      0      0   
  bitops-bits-in-byte            8    8.4      8    8.2      0    2.4   
  bitops-bitwise-and             2      2      2      2      0      0   
  bitops-nsieve-bits            13     13     12   12.8    7.7    1.5 ++
  controlflow-recursive          3    3.4      3    3.4      0      0   
  crypto-aes                    26   26.4     26   26.6      0   -0.8   
  crypto-md5                    10   10.2     10   10.4      0   -2.0   
  crypto-sha1                    9      9      8    8.8   11.1    2.2 ++
  date-format-tofte            186  197.4    186  196.6      0    0.4   
  math-cordic                   12   12.8     13     13   -8.3   -1.6 --
  math-partial-sums             63   63.4     65   65.2   -3.2   -2.8 - 
  math-spectral-norm             4    4.8      5      5    -25   -4.2 --
  s3d-cube                      17   17.8     17   17.6      0    1.1   
  s3d-morph                     24   24.2     24     24      0    0.8   
  s3d-raytrace                  26   26.2     26     26      0    0.8   
  string-fasta                  33   33.2     32     33    3.0    0.6   
  string-unpack-code           117  117.2    117  117.4      0   -0.2   
  string-validate-input         31   31.8     31   31.8      0      0   
Dir: sunspider/as3vector/
  access-fannkuch               20     20     20     20      0      0   
  access-nbody                   5      5      5    5.2      0   -4.0   
  access-nsieve                 11   11.6     11   11.2      0    3.4   
  bitops-nsieve-bits             6    6.8      6    6.4      0    5.9   
  math-cordic                   11   11.4     11   11.8      0   -3.5   
  math-spectral-norm            12   12.6     12   12.8      0   -1.6   
  s3d-cube                      14     14     14   14.4      0   -2.9   
  s3d-morph                     13   13.8     13   13.4      0    2.9   
  string-fasta                  35   35.2     35     35      0    0.6   
  string-validate-input         31   31.8     32     32   -3.2   -0.6 - 
Dir: sunspider-0.9.1/js/
  access-binary-trees           29   29.4     30   30.8   -3.4   -4.8 - 
  access-fannkuch               70   70.6     65     65    7.1    7.9 ++
  access-nbody                  62   62.6     62     62      0    1.0   
  access-nsieve                 39   39.2     21   21.6   46.2   44.9 ++
  bitops-3bit-bits-in-byte       6    6.8      7      7  -16.7   -2.9 --
  bitops-bits-in-byte           22   22.4     22   22.2      0    0.9   
  bitops-bitwise-and           183    183    179  179.4    2.2    2.0 + 
  bitops-nsieve-bits            24   24.8     25     25   -4.2   -0.8 - 
  controlflow-recursive         13     13     13     13      0      0   
  crypto-aes                    28   28.8     29   29.6   -3.6   -2.8   
  crypto-md5                    10   10.2     10   10.2      0      0   
  crypto-sha1                    9    9.6      9    9.6      0      0   
  math-cordic                   44   44.6     44   44.6      0      0   
  math-partial-sums            182  182.6    181    182    0.5    0.3   
  math-spectral-norm            21   21.4     21   21.8      0   -1.9   
  regexp-dna                   433  433.8    482  482.2  -11.3  -11.2 --
  s3d-cube                      54     54     54     54      0      0   
  s3d-morph                     50   50.6     50   50.4      0    0.4   
  s3d-raytrace                  60   60.6     60   60.2      0    0.7   
  string-fasta                  59     59     60   60.6   -1.7   -2.7 - 
  string-unpack-code          2853 2881.4   2901 2929.4   -1.7   -1.7   
  string-validate-input         37   37.4     36   36.6    2.7    2.1 + 
Dir: sunspider-0.9.1/typed/
  access-binary-trees            7      7      7      7      0      0   
  access-fannkuch               43     43     37   37.2   14.0   13.5 ++
  access-nbody                   3      3      3    3.2      0   -6.7   
  access-nsieve                 27   27.8     12     12   55.6   56.8 ++
  bitops-3bit-bits-in-byte       4      4      4      4      0      0   
  bitops-bits-in-byte            8    8.2      8    8.4      0   -2.4   
  bitops-bitwise-and             2    2.2      2      2      0    9.1   
  bitops-nsieve-bits            13     13     12   12.8    7.7    1.5 ++
  controlflow-recursive          3      3      3      3      0      0   
  crypto-aes                    21   21.2     21   21.2      0      0   
  crypto-md5                     3    3.2      3    3.6      0  -12.5   
  crypto-sha1                    2    2.6      3      3    -50  -15.4 --
  math-cordic                   12   12.2     11   11.8    8.3    3.3 + 
  math-partial-sums             10     10     10     10      0      0   
  math-spectral-norm             6      6      6      6      0      0   
  regexp-dna                   408  408.2    458    458  -12.3  -12.2 --
  s3d-cube                      14   14.8     14     14      0    5.4   
  s3d-morph                     36   36.6     36   36.4      0    0.5   
  s3d-raytrace                   8      8      8      8      0      0   
  string-fasta                  25   25.4     25   25.2      0    0.8   
  string-unpack-code          2849 2860.4   2905 2920.6   -2.0   -2.1 - 
  string-validate-input         24   24.2     24     24      0    0.8   
Metric: v8 custom v8 normalized metric (hardcoded in the test)
Dir: v8/
  crypto                       749  748.4    755  754.2    0.8    0.8 + 
  deltablue                   1966 1961.4   2005 2000.6    2.0    2.0 + 
  earley-boyer                1041 1034.6   1043 1038.4    0.2    0.4   
  raytrace                    3251 3244.8   3248 3244.4   -0.1   -0.0   
  richards                    1252 1251.2   1253 1249.8    0.1   -0.1   
Dir: v8/typed/
  crypto                       801  800.8    798    797   -0.4   -0.5 - 
  deltablue                   3114 3099.8   3087 3076.8   -0.9   -0.7 - 
  earley-boyer                1036 1028.8   1046   1038    1.0    0.9   
  raytrace                    7260   7243   7317   7291    0.8    0.7 + 
  richards                    2299 2298.2   2306 2303.2    0.3    0.2 + 
Dir: v8.5/js/
  crypto                       639  638.6    640  639.6    0.2    0.2 + 
  deltablue                    315  314.6    311    311   -1.3   -1.1 - 
  earley-boyer                1068 1060.8   1076 1072.6    0.7    1.1   
  raytrace                     742  740.4    743    743    0.1    0.4   
  regexp                       132    132    122    122   -7.6   -7.6 --
  richards                     286    286    285  284.6   -0.3   -0.5 - 
  splay                       1018  866.2   1029  901.6    1.1    4.1   
Dir: v8.5/optimized/
  crypto                      4251 4247.8   4195 4189.6   -1.3   -1.4 - 
  deltablue                   3503 3475.6   3648 3640.2    4.1    4.7 + 
  earley-boyer                1062 1055.4   1079 1072.6    1.6    1.6 + 
  raytrace                    8843 8809.6   8733   8707   -1.2   -1.2 - 
  regexp                       133    133    123    123   -7.5   -7.5 --
  richards                    4361 4357.4   4339   4336   -0.5   -0.5 - 
  splay                       6177 6158.2   6256 6251.2    1.3    1.5 + 
Dir: v8.5/typed/
  crypto                      2991 2984.4   2591   2572  -13.4  -13.8 --
  deltablue                   3719 3690.4   3701 3663.4   -0.5   -0.7   
  earley-boyer                1069   1063   1077   1072    0.7    0.8   
  raytrace                    8817   8799   8707 8696.4   -1.2   -1.2 - 
  regexp                       133    133    123    123   -7.5   -7.5 --
  richards                    4355   4355   4334 4331.6   -0.5   -0.5 - 
  splay                       1351   1349   1304 1301.6   -3.5   -3.5 - 
Dir: v8.5/untyped/
  crypto                       725  724.8    732  731.6    1.0    0.9 + 
  deltablue                   2039 2032.4   2062 2053.4    1.1    1.0 + 
  earley-boyer                1068 1061.6   1070 1065.2    0.2    0.3   
  raytrace                    3544 3531.2   3544 3534.2      0    0.1   
  regexp                       132    132    122    122   -7.6   -7.6 --
  richards                     484  482.6    488  486.2    0.8    0.7 + 
  splay                       1280   1277   1250   1240   -2.3   -2.9 -
Attachment #489851 - Flags: feedback?(edwsmith)
99% of all Arrays are plain-vanilla arrays, but in a many contexts, we have to act as though the "length" getter/setter might be overridden (as in a subclass); this adds a couple of function pointers to allow us to take a much quicker path for the common case. 

Adding this optimization to the previous ones puts us at ahead-or-even (within noise) almost pretty much across the board (timings to follow), so I think this is pretty close to reviewable.
Attachment #489959 - Flags: feedback?(edwsmith)
Timings with latest patch sequence. (Note that there are definite red herrings here; e.g., globalvar-write-1 claims to be +30% but the inner loop has nothing to do with Array; it's one that we have noticed inexplicable timing deltas on in the past. Ditto the various regexp regressions, which don't seem to have any significant time in Array code before or after. That said, overall trend is definite positive.)


                                   avm          avm2
test                          best    avg   best    avg  %dBst  %dAvg
Metric: iterations/second 
Dir: asmicro/
  alloc-1                       37     37     38     38    2.7    2.7 + 
  alloc-10                      13     13     14   13.3    7.7    2.6 ++
  alloc-11                      12     12     12     12      0      0   
  alloc-12                       8      8     12     12     50     50 ++
  alloc-13                      83   80.7     84   82.7    1.2    2.5   
  alloc-14                      69     68     68   66.7   -1.4   -2.0   
  alloc-2                       19     19     19     19      0      0   
  alloc-3                       15     15     16   15.3    6.7    2.2 ++
  alloc-4                       41   40.7     43   42.3    4.9    4.1 + 
  alloc-5                       28   27.7     30     30    7.1    8.4 ++
  alloc-6                       66   65.7     66   65.3      0   -0.5   
  alloc-7                       38   37.3     37     37   -2.6   -0.9 - 
  alloc-8                       14     14     14     14      0      0   
  alloc-9                       15   14.3     15   14.7      0    2.3   
  arguments-1                  674    672    671    669   -0.4   -0.4   
  arguments-2                  369  367.3    368  367.3   -0.3      0   
  arguments-3                   19     19     19     19      0      0   
  arguments-4                   25     25     26     26      4      4 + 
  array-1                     1455   1451   1598 1595.3    9.8    9.9 ++
  array-2                      500    499    530  527.3      6    5.7 ++
  array-pop-1                  300  297.7    283  279.3   -5.7   -6.2 --
  array-push-1                 250    249    260  258.3      4    3.7 + 
  array-shift-1                128    128    149    149   16.4   16.4 ++
  array-slice-1                 17     17     19   18.7   11.8    9.8 ++
  array-sort-1                  24     24     25     25    4.2    4.2 + 
  array-sort-2                   2      2      2      2      0      0   
  array-sort-3                  19     19     19     19      0      0   
  array-sort-4                   9      9      9      9      0      0   
  array-unshift-1              145  143.3    151  149.7    4.1    4.4 + 
  closedvar-read-1            3633 3625.3   3602 3581.7   -0.9   -1.2 - 
  closedvar-write-1           3910 3877.7   4464 4394.3   14.2   13.3 ++
  closedvar-write-2           4228 4201.3   3668   3627  -13.2  -13.7 --
  do-1                        3589 3572.7   3560 3553.7   -0.8   -0.5 - 
  for-1                       3559   3546   3566 3536.7    0.2   -0.3   
  for-2                       2186 2176.7   2189 2174.3    0.1   -0.1   
  for-3                       2285 2279.3   2287   2271    0.1   -0.4   
  for-in-1                     334  331.3    323  319.3   -3.3   -3.6 - 
  for-in-2                     137  135.7    307  304.7  124.1  124.6 ++
  funcall-1                    319    318    319  318.3      0    0.1   
  funcall-2                    209  208.7    210    210    0.5    0.6 + 
  funcall-3                    294    294    295    293    0.3   -0.3   
  funcall-4                    102    101    103  102.3    1.0    1.3   
  globalvar-read-1            3596 3563.7   3585 3557.7   -0.3   -0.2   
  globalvar-write-1           3584 3576.3   4844 4680.3   35.2   30.9 ++
  isNaN-1                     3403 3396.7   3414 3404.3    0.3    0.2   
  isNaN-2                     3584 3576.3   3591   3575    0.2   -0.0   
  isNaN-3                     3156   3151   3165 3160.3    0.3    0.3 + 
  lookup-array-fetch-1         676  675.7    667  666.3   -1.3   -1.4 - 
  lookup-array-in-1           1485 1482.3   1541 1539.3    3.8    3.8 + 
  lookup-negindex-array-1      405  404.3    400    400   -1.2   -1.1 - 
  lookup-negindex-array-2      347  343.3    341    339   -1.7   -1.3   
  lookup-negindex-object-1     413  407.3    414  412.3    0.2    1.2   
  lookup-negindex-object-2     382  380.7    385  380.3    0.8   -0.1   
  lookup-object-fetch-1        745  735.7    722  721.3   -3.1   -1.9 - 
  lookup-object-in-1          1325   1311   1346 1333.3    1.6    1.7   
  number-toString-1              5      5      5      5      0      0   
  number-toString-2             66   65.3     66   65.7      0    0.5   
  oop-1                          3      3      3      3      0      0   
  parseFloat-1                  67     67     66     66   -1.5   -1.5 - 
  parseInt-1                   158    158    159    159    0.6    0.6   
  regex-exec-1                  61   60.7     62   61.3    1.6    1.1 + 
  regex-exec-2                  73   72.7     73     73      0    0.5   
  regex-exec-3                 101    101    103    103    2.0    2.0 + 
  regex-exec-4                 278  276.3    285  284.3    2.5    2.9 + 
  restarg-1                    674  672.7    675    671    0.1   -0.2   
  restarg-2                    396  394.3    396  394.3      0      0   
  restarg-3                     34     34     34   33.3      0   -2.0   
  restarg-4                     25     25     26     26      4      4 + 
  string-casechange-1           22     22     23     23    4.5    4.5 + 
  string-casechange-2           23   22.7     23   22.7      0      0   
  string-charAt-1             1288   1286   1286 1285.7   -0.2   -0.0   
  string-charAt-2               75   74.3     75   74.7      0    0.4   
  string-charCodeAt-1         1359 1356.7   1367   1359    0.6    0.2   
  string-charCodeAt-2         1281 1279.3   1283 1281.7    0.2    0.2   
  string-charCodeAt-3         1020 1012.3   1026 1023.7    0.6    1.1   
  string-charCodeAt-4         1728 1726.3   1728 1727.3      0    0.1   
  string-charCodeAt-5          862  861.7    863  856.7    0.1   -0.6   
  string-charCodeAt-6         1371   1369   1368 1366.7   -0.2   -0.2 - 
  string-charCodeAt-7         1730   1729   1728   1721   -0.1   -0.5   
  string-fromCharCode-1        288  286.7    288    286      0   -0.2   
  string-fromCharCode-2         59     59     60     60    1.7    1.7 + 
  string-indexOf-1             191    191    191  190.3      0   -0.3   
  string-indexOf-2             114    114    145    145   27.2   27.2 ++
  string-indexOf-3             103  102.7    103    102      0   -0.6   
  string-lastIndexOf-1         461  460.3    461  460.7      0    0.1   
  string-lastIndexOf-2         145    145    143    143   -1.4   -1.4 - 
  string-lastIndexOf-3       141.9  141.7  140.9  140.8   -0.7   -0.7   
  string-slice-1               111    111    111    111      0      0   
  string-split-1                 8      8      8      8      0      0   
  string-split-2                 8      8      8      8      0      0   
  string-substring-1           118    118    119    119    0.8    0.8   
  switch-1                     700  699.3    700    699      0   -0.0   
  switch-2                      98   97.7     98     98      0    0.3   
  switch-3                     172    172    172    172      0      0   
  try-1                        218    218    219  218.7    0.5    0.3 + 
  try-2                         14     14     14     14      0      0   
  try-3                         45     45     46     46    2.2    2.2 + 
  vector-push-1                 39     39     37     37   -5.1   -5.1 --
  while-1                     3583 3581.7   3583 3565.7      0   -0.4   
Metric: time 
Dir: jsbench/
  Crypt                       3827 3838.3   3772   3776    1.4    1.6 + 
  Euler                       7426   7443   7205   7230    3.0    2.9 + 
  FFT                         7018   7055   7136 7152.7   -1.7   -1.4 - 
  HeapSort                    3559 3575.3   3535 3539.7    0.7    1.0   
  LUFact                      5882   5885   5813   5816    1.2    1.2 + 
  Moldyn                     10067 10086.7   9979 10029.3    0.9    0.6 + 
  RayTracer                   7172 7194.3   7199 7230.3   -0.4   -0.5   
  SOR                        32557 32571.7  32486 32503.3    0.2    0.2 + 
  Series                      8871 8879.7   8954   8978   -0.9   -1.1 - 
  SparseMatmult              10494 10543.7  10248 10299.3    2.3    2.3 + 
Dir: jsbench/typed/
  Crypt                        965  966.3    965  965.7      0    0.1   
  Euler                       9070 9085.7   9033   9082    0.4    0.0   
  FFT                         1578 1581.7   1601   1602   -1.5   -1.3 - 
  HeapSort                    1353 1366.7   1336   1337    1.3    2.2   
  LUFact                      1326 1327.7   1319 1319.3    0.5    0.6 + 
  Moldyn                      4506 4511.7   4508 4518.7   -0.0   -0.2   
  RayTracer                   1347 1347.7   1342 1342.7    0.4    0.4 + 
  SOR                         4450 4465.7   4442   4455    0.2    0.2   
  Series                      7710 7751.3   7665 7720.7    0.6    0.4   
  SparseMatmult               2642 2645.3   2657 2658.3   -0.6   -0.5 - 
Metric: iterations/second 
Dir: jsmicro/
  alloc-1                       37   36.7     37     37      0    0.9   
  alloc-10                      13     13     13     13      0      0   
  alloc-11                      11     11     11     11      0      0   
  alloc-12                       7      7     11     11   57.1   57.1 ++
  alloc-13                      72   71.3     72     71      0   -0.5   
  alloc-14                      61   60.7     62   61.7    1.6    1.6 + 
  alloc-2                       19     19     19     19      0      0   
  alloc-3                       15     15     15     15      0      0   
  alloc-4                       41     41     41     41      0      0   
  alloc-5                       30     30     29     29   -3.3   -3.3 - 
  alloc-6                       58     58     58     58      0      0   
  alloc-7                       37     37     37     37      0      0   
  alloc-8                       14     14     14     14      0      0   
  alloc-9                       14     14     14     14      0      0   
  arguments-1                  146  145.7    145    144   -0.7   -1.1   
  arguments-2                  104    104    104    104      0      0   
  arguments-3                   17     17     17     17      0      0   
  array-1                      371    371    378  377.3    1.9    1.7 + 
  array-2                      282    282    259    259   -8.2   -8.2 --
  array-pop-1                   61   60.3     64     64    4.9    6.1 + 
  array-push-1                  41     41     42     42    2.4    2.4 + 
  array-shift-1                 52     52     58   57.7   11.5   10.9 ++
  array-slice-1                 14     14     16   15.7   14.3   11.9 ++
  array-sort-1                  23     23     24     24    4.3    4.3 + 
  array-sort-2                   2      2      2      2      0      0   
  array-sort-3                  19     19     19     19      0      0   
  array-sort-4                   9      9      9      9      0      0   
  array-unshift-1               20     20     21     21      5      5 + 
  closedvar-read-1             609    608    611    610    0.3    0.3 + 
  closedvar-write-1            441    441    441    440      0   -0.2   
  closedvar-write-2            430    425    438    435    1.9    2.4   
  do-1                         607    606    610  608.7    0.5    0.4 + 
  for-1                        604  603.3    601  600.3   -0.5   -0.5 - 
  for-2                        184    184    185  184.7    0.5    0.4 + 
  for-3                        135  134.7    134    134   -0.7   -0.5 - 
  for-in-1                     265  264.7    257  256.3   -3.0   -3.1 - 
  for-in-2                     128  127.7    250  249.7   95.3   95.6 ++
  funcall-1                    208  207.3    207    207   -0.5   -0.2 - 
  funcall-2                    203    203    202    202   -0.5   -0.5   
  funcall-3                    200    200    199  198.3   -0.5   -0.8 - 
  funcall-4                   1324   1319   1328   1313    0.3   -0.5   
  globalvar-read-1             600  598.7    599  598.3   -0.2   -0.1   
  globalvar-write-1            433  431.7    429  428.7   -0.9   -0.7 - 
  isNaN-1                      516  515.3    519  517.7    0.6    0.5 + 
  lookup-array-fetch-1         592  591.3    586  585.3   -1.0   -1.0 - 
  lookup-array-in-1            980    979    984  983.3    0.4    0.4 + 
  lookup-object-fetch-1        648  647.7    643  642.7   -0.8   -0.8 - 
  lookup-object-in-1           879  877.3    884  883.3    0.6    0.7 + 
  number-toString-1              5      5      5      5      0      0   
  number-toString-2             55     54     55     55      0    1.9   
  oop-1                          3      3      3      3      0      0   
  parseFloat-1                  50     50     50   49.3      0   -1.3   
  parseInt-1                   111    111    114    114    2.7    2.7 + 
  regex-exec-1                  54   53.7     53   52.7   -1.9   -1.9 - 
  regex-exec-2                  64     64     65     65    1.6    1.6 + 
  regex-exec-3                  92     92     93     93    1.1    1.1 + 
  regex-exec-4                 235    234    234  233.3   -0.4   -0.3   
  string-casechange-1           15     15     15     15      0      0   
  string-casechange-2           15     15     15     15      0      0   
  string-charAt-1               97     96     97   96.3      0    0.3   
  string-charAt-2               42     42     43     43    2.4    2.4 + 
  string-charCodeAt-1           87     87     88   87.3    1.1    0.4 + 
  string-charCodeAt-2           88     88     88     88      0      0   
  string-fromCharCode-1         73     73     73     73      0      0   
  string-fromCharCode-2         37   36.3     37     37      0    1.8   
  string-fromCharCode-3         65     65     65     65      0      0   
  string-fromCharCode-4         69     69     69     69      0      0   
  string-indexOf-1              78     78     78     78      0      0   
  string-indexOf-2              51     51     56     56    9.8    9.8 ++
  string-indexOf-3              48   47.7     49     49    2.1    2.8 + 
  string-lastIndexOf-1          78     78     78     78      0      0   
  string-lastIndexOf-2          56     56     57   56.3    1.8    0.6 + 
  string-lastIndexOf-3          73   72.3     74   73.7    1.4    1.8 + 
  string-slice-1                47     47     46     46   -2.1   -2.1 - 
  string-split-1                 7      7      7      7      0      0   
  string-split-2                 7      7      7      7      0      0   
  string-substring-1            50     50     49     49     -2     -2 - 
  switch-1                     109    109    108    108   -0.9   -0.9   
  switch-2                      55   54.3     55     55      0    1.2   
  switch-3                      69     68     70   69.7    1.4    2.5   
  try-1                        143    143    145    145    1.4    1.4 + 
  try-2                         13     13     13     13      0      0   
  try-3                         34     34     35     35    2.9    2.9 + 
  while-1                      605    604    602  600.7   -0.5   -0.6 - 
Metric: time 
Dir: language/describetype/
  desctypeperf                 599  599.3    600  602.3   -0.2   -0.5   
Dir: language/e4x/
  addingToXMLList               19     19     18   18.3    5.3    3.5 ++
  appendChildAndString          53   53.7     53   53.7      0      0   
concatenatingStringsFromE4X      7    7.3      7      7      0    4.5   
  simpleStringConcatenation      1    1.3      1    1.3      0      0   
  usingAppendChildAndE4X        55     56     54   54.3    1.8    3.0   
Dir: language/string/
  append_concat                 81     82     81     81      0    1.2   
  append_equal_plus             67   67.7     66   66.7    1.5    1.5   
  append_plus_equal             67     68     66   66.3    1.5    2.5   
  charAt                       171  173.7    172  172.3   -0.6    0.8   
  charCodeAt                   204    204    204  204.7      0   -0.3   
  indexOf                      303  303.3    298  298.3    1.7    1.6 + 
  lastIndexOf                  208    208    208  208.7      0   -0.3   
  replace                      520  523.3    518  518.7    0.4    0.9   
  replace2                     823  823.7    870  870.3   -5.7   -5.7 --
  search                        36   36.3     35   35.7    2.8    1.8 + 
  slice                        278    278    276    277    0.7    0.4 + 
  split                        338    346    339  341.7   -0.3    1.3   
  static_ascii_array_100       978  979.3    253  253.7   74.1   74.1 ++
  static_ascii_array_50        965  966.7    235    235   75.6   75.7 ++
  static_latin1_array_100     1920   1924    478    480   75.1   75.1 ++
  static_latin1_array_50       963  963.7    239    239   75.2   75.2 ++
  substr                       204  204.3    204  204.3      0      0   
  substring                    194    195    194    194      0    0.5   
Dir: language/string/typed/
  append_concat                 73   73.7     75   75.3   -2.7   -2.3 - 
  append_equal_plus             61     62     61   61.7      0    0.5   
  append_plus_equal             61   61.7     61   61.3      0    0.5   
  charAt                        11   11.7     11   11.7      0      0   
  charCodeAt                    12     12     10     11   16.7    8.3 ++
  indexOf                      303    303    297  297.7    2.0    1.8 + 
  lastIndexOf                  208  208.3    209    209   -0.5   -0.3 - 
  replace                      522  525.3    518  518.7    0.8    1.3 + 
  replace2                     825    827    870    872   -5.5   -5.4 --
  search                        36     36     35   35.7    2.8    0.9 + 
  slice                        181    182    182  182.3   -0.6   -0.2   
  split                        334  335.3    340  340.3   -1.8   -1.5 - 
  substr                       144  144.3    143  143.7    0.7    0.5 + 
  substring                    126  126.7    127    127   -0.8   -0.3 - 
Dir: misc/
  boids                       1881 1883.7   1810 1810.3    3.8    3.9 + 
  boidshack                    500  501.3    443  445.3   11.4   11.2 ++
  gameoflife                  2474   2479   1816 1826.7   26.6   26.3 ++
  primes                      5149 5155.3   5148 5155.7    0.0   -0.0   
Dir: mmgc/
  gcbench                     2917 2924.3   2912 2922.3    0.2    0.1   
  ofib-rc                      270    275    269    270    0.4    1.8   
  ofib                        1197 1218.7   1210   1217   -1.1    0.1   
  sfib                         375    376    376    377   -0.3   -0.3   
Dir: scimark/
  FFT                         2288 2292.7   2309 2309.3   -0.9   -0.7 - 
  LU                          3066   3068   3032 3036.7    1.1    1.0 + 
  MonteCarlo                  2746 2749.7   2722   2733    0.9    0.6 + 
  SOR                         2528   2533   2558   2563   -1.2   -1.2 - 
  SparseCompRow                102  102.3     99   99.7    2.9    2.6 + 
Dir: sunspider/
  access-binary-trees           33   33.3     34     34   -3.0   -2.0 - 
  access-fannkuch               86   86.3     82   82.3    4.7    4.6 + 
  access-nbody                  84   84.3     83   83.7    1.2    0.8 + 
  access-nsieve                 44     45     26     26   40.9   42.2 ++
  bitops-3bit-bits-in-byte      10   10.3     10   10.3      0      0   
  bitops-bits-in-byte           29     29     30     30   -3.4   -3.4 - 
  bitops-bitwise-and           212  212.3    212    212      0    0.2   
  bitops-nsieve-bits            42   42.3     41     41    2.4    3.1 + 
  controlflow-recursive         15   15.7     15   15.7      0      0   
  crypto-aes                    42     42     42     42      0      0   
  crypto-md5                    19   19.7     20     20   -5.3   -1.7 --
  crypto-sha1                   20     20     19   19.7      5    1.7 + 
  date-format-tofte            179  181.3    179  180.7      0    0.4   
  math-cordic                   54   54.3     54   54.3      0      0   
  math-partial-sums            185  185.3    185    185      0    0.2   
  math-spectral-norm            28   28.3     28     28      0    1.2   
  s3d-cube                      70   70.7     69     69    1.4    2.4 + 
  s3d-morph                     41     41     41   41.3      0   -0.8   
  s3d-raytrace                  78   78.3     77   77.7    1.3    0.9 + 
  string-fasta                  81     82     82     82   -1.2      0 - 
  string-unpack-code           173  174.7    173  173.7      0    0.6   
  string-validate-input         43   43.3     43   43.7      0   -0.8   
Dir: sunspider/as3/
  access-binary-trees            9    9.3      9    9.3      0      0   
  access-fannkuch               55   55.7     50   50.7    9.1    9.0 ++
  access-nbody                   6    6.3      6    6.3      0      0   
  access-nsieve                 33     33     14   14.3   57.6   56.6 ++
  bitops-3bit-bits-in-byte       6      6      5    5.7   16.7    5.6 ++
  bitops-bits-in-byte            9    9.3      9    9.3      0      0   
  bitops-bitwise-and             2      2      2      2      0      0   
  bitops-nsieve-bits            27   27.3     27     27      0    1.2   
  controlflow-recursive          4    4.3      4      4      0    7.7   
  crypto-aes                    31     31     32     32   -3.2   -3.2 - 
  crypto-md5                    24     24     23     24    4.2      0 + 
  crypto-sha1                   19     19     18   18.3    5.3    3.5 ++
  date-format-tofte            172  172.7    171  173.7    0.6   -0.6   
  math-cordic                   14     14     13   13.3    7.1    4.8 ++
  math-partial-sums             64   64.7     65     65   -1.6   -0.5 - 
  math-spectral-norm             5    5.3      5    5.7      0   -6.3   
  s3d-cube                      21   21.7     20     21    4.8    3.1   
  s3d-morph                     29   29.3     29     30      0   -2.3   
  s3d-raytrace                  33     33     33   33.3      0   -1.0   
  string-fasta                  40     40     40     40      0      0   
  string-unpack-code           172    172    172  172.7      0   -0.4   
  string-validate-input         33     33     33   33.3      0   -1.0   
Dir: sunspider/as3vector/
  access-fannkuch               22     22     22   22.3      0   -1.5   
  access-nbody                   6    6.3      6    6.7      0   -5.3   
  access-nsieve                 12     12     12     12      0      0   
  bitops-nsieve-bits             8      8      8      8      0      0   
  math-cordic                   14     14     14   14.3      0   -2.4   
  math-spectral-norm            16   16.7     16   16.7      0      0   
  s3d-cube                      16   16.7     16   16.3      0    2.0   
  s3d-morph                     16   16.7     16     16      0    4.0   
  string-fasta                  42   42.7     42   42.3      0    0.8   
  string-validate-input         35   35.3     35   35.3      0      0   
Dir: sunspider-0.9.1/js/
  access-binary-trees           32   32.7     33   33.3   -3.1   -2.0 - 
  access-fannkuch               85   85.3     81     81    4.7    5.1 + 
  access-nbody                  78     79     78   78.7      0    0.4   
  access-nsieve                 42   42.3     25     25   40.5   40.9 ++
  bitops-3bit-bits-in-byte       9      9      8    8.7   11.1    3.7 ++
  bitops-bits-in-byte           29   29.7     29   29.3      0    1.1   
  bitops-bitwise-and           210  210.7    212    212   -1.0   -0.6 - 
  bitops-nsieve-bits            40     41     40   40.3      0    1.6   
  controlflow-recursive         14   14.7     15     15   -7.1   -2.3 --
  crypto-aes                    35   35.3     35   35.3      0      0   
  crypto-md5                    16   16.3     17     17   -6.2   -4.1 --
  crypto-sha1                   18     18     18     18      0      0   
  math-cordic                   52   52.3     52     52      0    0.6   
  math-partial-sums            187  187.7    188    188   -0.5   -0.2 - 
  math-spectral-norm            27   27.7     27   27.7      0      0   
  regexp-dna                   829  839.3    858  874.3   -3.5   -4.2 - 
  s3d-cube                      63   64.7     62     63    1.6    2.6   
  s3d-morph                     58   60.3     58   58.7      0    2.8   
  s3d-raytrace                  71   71.3     71   71.7      0   -0.5   
  string-fasta                  57     57     57   57.3      0   -0.6   
  string-unpack-code          4456 4480.7   4353 4442.3    2.3    0.9 + 
  string-validate-input         42     42     42     42      0      0   
Dir: sunspider-0.9.1/typed/
  access-binary-trees            8      8      8      8      0      0   
  access-fannkuch               57   57.7     53     53    7.0    8.1 ++
  access-nbody                   4      4      4      4      0      0   
  access-nsieve                 30   31.3     13     13   56.7   58.5 ++
  bitops-3bit-bits-in-byte       5      5      4    4.3     20   13.3 + 
  bitops-bits-in-byte            9      9      9      9      0      0   
  bitops-bitwise-and             2      2      2      2      0      0   
  bitops-nsieve-bits            27   27.3     26   26.7    3.7    2.4 + 
  controlflow-recursive          3    3.3      4      4  -33.3  -20.0 --
  crypto-aes                    26   26.7     26   26.7      0      0   
  crypto-md5                     4      4      4    4.3      0   -8.3   
  crypto-sha1                    5      5      5      5      0      0   
  math-cordic                   12   12.7     12   12.7      0      0   
  math-partial-sums             11     11     11   11.3      0   -3.0   
  math-spectral-norm             8      8      7    7.7   12.5    4.2 ++
  regexp-dna                   798  799.7    826  844.7   -3.5   -5.6 - 
  s3d-cube                      18   18.3     17     17    5.6    7.3 ++
  s3d-morph                     47     48     49     49   -4.3   -2.1 - 
  s3d-raytrace                   8    8.7      9    9.3  -12.5   -7.7 - 
  string-fasta                  31     32     31   31.7      0    1.0   
  string-unpack-code          4412   4483   4469   4491   -1.3   -0.2   
  string-validate-input         26     27     27     27   -3.8      0 - 
Metric: v8 custom v8 normalized metric (hardcoded in the test)
Dir: v8/
  crypto                       448  447.3    446  445.3   -0.4   -0.4 - 
  deltablue                   1550 1549.3   1541   1541   -0.6   -0.5 - 
  earley-boyer                1008 1006.3   1008   1004      0   -0.2   
  raytrace                    2874 2866.3   2888 2882.7    0.5    0.6 + 
  richards                    1014 1010.3    990    988   -2.4   -2.2 - 
Dir: v8/typed/
  crypto                       462    460    458    457   -0.9   -0.7 - 
  deltablue                   2420 2417.7   2422 2420.7    0.1    0.1   
  earley-boyer                1015   1010   1009   1007   -0.6   -0.3   
  raytrace                    6298 6291.7   6304 6291.7    0.1      0   
  richards                    1912   1910   1865 1863.7   -2.5   -2.4 - 
Dir: v8.5/js/
  crypto                       398    398    397  396.3   -0.3   -0.4 - 
  deltablue                    299  298.3    299    299      0    0.2   
  earley-boyer                1009    998   1007   1003   -0.2    0.5   
  raytrace                     639  638.7    647  644.7    1.3    0.9 + 
  regexp                      86.5   86.3   85.1   84.9   -1.6   -1.5 - 
  richards                     244  243.7    241    240   -1.2   -1.5 - 
  splay                        732  689.3    737    696    0.7    1.0   
Dir: v8.5/optimized/
  crypto                      3551   3547   3521   3498   -0.8   -1.4   
  deltablue                   3019 3018.3   3162   3162    4.7    4.8 + 
  earley-boyer                1006 1002.3    999  997.7   -0.7   -0.5 - 
  raytrace                    7510 7507.3   7618 7607.7    1.4    1.3 + 
  regexp                      86.9   86.7   85.6   85.4   -1.5   -1.5 - 
  richards                    3707   3702   3623 3620.3   -2.3   -2.2 - 
  splay                       5564 5487.7   5293 5288.3   -4.9   -3.6 - 
Dir: v8.5/typed/
  crypto                      2736   2734   2740 2724.3    0.1   -0.4   
  deltablue                   3262 3255.3   3236 3233.7   -0.8   -0.7 - 
  earley-boyer                1007   1004    997  994.3   -1.0   -1.0 - 
  raytrace                    7540   7530   7602   7595    0.8    0.9 + 
  regexp                      86.8   86.7   85.6   85.4   -1.4   -1.5 - 
  richards                    3715   3706   3630 3625.3   -2.3   -2.2 - 
  splay                        931  930.7    937  931.7    0.6    0.1   
Dir: v8.5/untyped/
  crypto                       436    434    434    433   -0.5   -0.2   
  deltablue                   1597 1592.7   1598 1597.7    0.1    0.3   
  earley-boyer                1012 1009.3   1001   1000   -1.1   -0.9 - 
  raytrace                    3078   3072   3091   3089    0.4    0.6 + 
  regexp                      87.8   87.7   85.9   85.8   -2.2   -2.1 - 
  richards                     411  409.7    411  410.7      0    0.2   
  splay                        888    872    887  878.3   -0.1    0.7
nice work, an idea late to the party and maybe you've already thought of it , but what about waiting until the first 'set' to decide whether or not its sparse?

The justification being that a 'low' valued int index might be a good indicator for keeping it sparse.

On the other hand seeing an object being used as an index might bias your decision.

Likewise, with this technique you could introduce thresholds for transitioning out of sparse.  I.e. integer based access might have a higher threshold , whereas string based could be lower.
If I understand the patches correctly, the design is "dense until proven otherwise".  So an empty array is dense, and a 1-element array is dense, and you can't be sparse until you have 2 elements that are far enough away from each other.

Rick: Given this, are you proposing that we add new code to support sparse->dense conversion?  Because as things stand, the only transition is dense->sparse, and that can't happen until after 2 sets.  (Steven: jump in and correct me any time).
Comment on attachment 489711 [details] [diff] [review]
Faster prototype

cool.  I didn't quite grok why the upper limit of dense values needed to be 0x7fffffff.  It's probably fine, but worth 10 minutes to see if we can think of a different clever encoding that would allow the full range.  Would it be enough to just have the [start,end) range be empty?
Attachment #489711 - Flags: feedback?(edwsmith) → feedback+
Comment on attachment 489851 [details] [diff] [review]
Add dense-array specialization for unshift

looks straightforward.  i didn't review the new code for correctness though.
Attachment #489851 - Flags: feedback?(edwsmith) → feedback+
Comment on attachment 489959 [details] [diff] [review]
Add special-casing for length accessors

> +    /*static*/ uint32_t ArrayObject::LengthGetter_Undef(ArrayObject* self)
...
> +        typedef uint32_t (*LengthGetter)(ArrayObject*); 

Ow, my eyes! my eyes!  InitialCapsAnd_Underscores?  phulleeese.

The blob of code that checks to see if length() is overridden should be factored as an API on Traits, probably.  It sure doesn't belong in the Array object.

In all this seems like a heavy and intrusive optimization, for what it's providing.  Could you isolate the the tests it helps and explain better why we'd want the complexity?  (virtual method which call a function pointer, etc)
Attachment #489959 - Flags: feedback?(edwsmith) → feedback-
(In reply to comment #18)
> If I understand the patches correctly, the design is "dense until proven
> otherwise". 

That's correct.
 
> So an empty array is dense, and a 1-element array is dense, and
> you can't be sparse until you have 2 elements that are far enough away from
> each other.

Yep; also there's a min-size threshold (currently 32) under which we assume dense even if there's "too few" items.

> Rick: Given this, are you proposing that we add new code to support
> sparse->dense conversion?  Because as things stand, the only transition is
> dense->sparse, and that can't happen until after 2 sets.  (Steven: jump in and
> correct me any time).

Correct.

In reply to comment #19)
> cool.  I didn't quite grok why the upper limit of dense values needed to be
> 0x7fffffff.  It's probably fine, but worth 10 minutes to see if we can think of
> a different clever encoding that would allow the full range.  Would it be
> enough to just have the [start,end) range be empty?

Main reason is that allows us to use m_denseStart as a flag for "dense/sparse/sealed"; by keeping indices <= 0x7fffffff we can ensure that "index - densestart < denselength" is a valid test for a dense index.

(In reply to comment #21)
> Ow, my eyes! my eyes!  InitialCapsAnd_Underscores?  phulleeese.

Guilty as charged.
 
> The blob of code that checks to see if length() is overridden should be
> factored as an API on Traits, probably.  It sure doesn't belong in the Array
> object.

Fair enough.
 
> In all this seems like a heavy and intrusive optimization, for what it's
> providing.  Could you isolate the the tests it helps and explain better why
> we'd want the complexity?  (virtual method which call a function pointer, etc)

Will do.
(In reply to comment #18)
> Because as things stand, the only transition is dense->sparse, and that can't happen until after 2 sets.  

Perfect, thanks for clarifying and a threshold limit of 32 sounds more than generous.
(In reply to comment #22)
> > In all this seems like a heavy and intrusive optimization, for what it's
> > providing.  Could you isolate the the tests it helps and explain better why
> > we'd want the complexity?  (virtual method which call a function pointer, etc)

After looking a bit further, I think most of the improvement I was seeing is of the inexplicable-voodoo variety. I'm going to withdraw this part of the patch.
FWIW, I think the remaining slowdown in a few cases is actually due to the fastpath in setuintproperty having to read the existing slot (to see if it had a hole and thus needs to adjust m_denseUsed). I'll ponder if there's any way to finess that to avoid it for the common case (which tends to be 100% dense).
If the arrays in the slowed-down cases are 100% dense, then a) that's surprising since dense arrays should be faster than sparse ones, and b) the simple experiment for just those tests is to only support 100% denseness, and skip the "hole" check.
Comment on attachment 489959 [details] [diff] [review]
Add special-casing for length accessors

Withdrawing, dubious usefulness
Attachment #489959 - Attachment is obsolete: true
(In reply to comment #26)
> If the arrays in the slowed-down cases are 100% dense, then a) that's
> surprising since dense arrays should be faster than sparse ones

They are; the issue is that the "old" dense array code didn't have to check for holes in the dense array, while the new one does. In a few situations (mainly synthetic benchmarks that do nothing but call setuintproperty 10000000 times) this adds up.
Attached patch A few more optimizations (obsolete) — Splinter Review
Mostly small effects, but add up for the microbenchmarks:
-- in _setUintProperty, don't check for DENSE_ARRAY_HOLE unless denseUsed < denseLen
-- add a List::replace() function; this is like List::set() but doesn't check for list lengthening. (Useful when we know the index is valid, avoid redundant runtime checks.)
-- remove runtime "isEmpty" checks from List::removeFirst and List::removeLast (we already were asserting that the list wasn't empty, so the check was redundant)
-- Specialize List::removeLast rather than calling removeAt(len-1).
-- minor optimizing of code in List::removeAt.
Attachment #491383 - Flags: review?(edwsmith)
Results from latest patch series (ignoring noise):

Again, some of these are sensible but some are inexplicable... eg, several regressions in regexp-related tests, none of which have hotspots anywhere near array code. Even weirder is isNaN-3, which is a loop that calls isNaN a jillion times... hard to figure why array changes could affect is plus or minus.

                                      avm          avm2
test                          best    avg   best    avg  %dBst  %dAvg
Metric: iterations/second 
Dir: asmicro/
  alloc-12                       8      8     12     12     50     50 ++
  array-1                     1472   1465   1606 1604.7    9.1    9.5 ++
  array-shift-1                128    128    151  150.7   18.0   17.7 ++
  for-in-2                     139    139    308  307.7  121.6  121.3 ++
  globalvar-write-1           4619 4495.7   4900 4874.3    6.1    8.4 + 
  isNaN-1                     3508 3467.7   3374 3332.7   -3.8   -3.9 - 
  isNaN-3                     3535   3510   3184 3177.7   -9.9   -9.5 --
  parseFloat-1                  64   62.7     65     65    1.6    3.7 + 
  regex-exec-1                  59   58.7     60     60    1.7    2.3 + 
  regex-exec-3                 102  101.7    104  103.7    2.0    2.0 + 
  restarg-3                     33     33     34     34    3.0    3.0 + 
  restarg-4                     26   25.7     26     26      0    1.3   
  string-casechange-1           23   22.7     22   21.3   -4.3   -5.9 - 
  string-indexOf-1             199  198.7    190  189.7   -4.5   -4.5 - 
  string-indexOf-2             145  144.7    114    114  -21.4  -21.2 --
  try-1                        212    211    217  216.7    2.4    2.7 + 
  try-2                         14   13.3     14     14      0    5.0   
  try-3                         42     42     45     45    7.1    7.1 ++
Metric: time 
Dir: jsbench/
  Euler                       7485 7524.3   7240 7244.7    3.3    3.7 + 
  FFT                         7193 7206.3   7036   7085    2.2    1.7 + 
  LUFact                      5959 6006.3   5812 5852.7    2.5    2.6 + 
  Moldyn                     10215 10305.3  10074 10149.7    1.4    1.5   
Dir: jsbench/typed/
  FFT                         1626 1638.3   1574 1599.3    3.2    2.4 + 
Metric: iterations/second 
Dir: jsmicro/
  alloc-12                       7      7     11     11   57.1   57.1 ++
  alloc-2                       18     18     19     19    5.6    5.6 ++
  alloc-3                       15     15     16     16    6.7    6.7 ++
  array-2                    277.7  277.0  263.7  263.6   -5.0   -4.8 --
  array-pop-1                 61.2   61.1   63.7   63.5    4.0    4.0 + 
  array-push-1                41.5   41.4   42.3   42.2    2.0    2.0 + 
  array-shift-1               52.9   52.8   57.2   57.1    8.0    8.1 ++
  array-slice-1               14.8   14.8   14.3   14.3   -3.5   -3.6 - 
  array-sort-4                 9.8    9.7    9.9    9.9    1.6    2.3 + 
  array-unshift-1             21.6   21.5   16.0   16.0  -25.9  -25.7 --
  for-in-2                     129  128.7    250  249.3   93.8   93.8 ++
  globalvar-write-1            427  426.3    435    434    1.9    1.8 + 
  lookup-array-fetch-1         586    586    593    593    1.2    1.2 + 
  string-indexOf-2              57     57     52     52   -8.8   -8.8 --
  string-lastIndexOf-1          75   74.7     78   77.7      4    4.0 + 
Metric: time 
Dir: language/string/
  replace2                     823    824    872    873   -6.0   -5.9 --
  static_ascii_array_100       969    970    261    262   73.1   73.0 ++
  static_ascii_array_50        956    958    243  246.3   74.6   74.3 ++
  static_latin1_array_100     1908   1908    492  494.7   74.2   74.1 ++
  static_latin1_array_50       955    956    247    247   74.1   74.2 ++
Dir: language/string/typed/
  append_plus_equal             63     63     61   61.7    3.2    2.1 + 
  replace2                     827    828    874  875.3   -5.7   -5.7 --
Dir: misc/
  boids                       1878 1879.7   1852 1853.3    1.4    1.4 + 
  boidshack                    500    502    454  454.7    9.2    9.4 ++
  gameoflife                  2463 2465.3   1823 1823.3   26.0   26.0 ++
Dir: mmgc/
  ofib                        1238   1257   1182   1201    4.5    4.5 + 
Dir: scimark/
  SparseCompRow                109    109    100    100    8.3    8.3 ++
Dir: sunspider/
  access-fannkuch               86   86.3     83   83.3    3.5    3.5 + 
  access-nsieve                 44   44.3     27     27   38.6   39.1 ++
Dir: sunspider/as3/
  access-fannkuch               55     55     49     49   10.9   10.9 ++
  access-nsieve                 33     33     14     14   57.6   57.6 ++
Dir: sunspider-0.9.1/js/
  access-nsieve                 43     43     25   25.7   41.9   40.3 ++
  regexp-dna                   841    843    884  885.7   -5.1   -5.1 --
Dir: sunspider-0.9.1/typed/
  access-fannkuch               57     57     52   52.3    8.8    8.2 ++
  access-nsieve                 30   30.3     12   12.3     60   59.3 ++
  regexp-dna                   793    795    826  827.7   -4.2   -4.1 - 
Metric: v8 custom v8 normalized metric (hardcoded in the test)
Dir: v8/typed/
  richards                    1929 1927.3   1838   1836   -4.7   -4.7 - 
Dir: v8.5/js/
  regexp                      88.1   87.9   84.7   84.6   -3.9   -3.8 - 
Dir: v8.5/optimized/
  deltablue                   3031 3024.3   3171 3156.3    4.6    4.4 + 
  regexp                        89   88.8   84.9   84.7   -4.6   -4.6 - 
Dir: v8.5/typed/
  regexp                      88.9   88.5     85   84.6   -4.4   -4.4 - 
Dir: v8.5/untyped/
  regexp                      88.6   88.4   84.9   84.7   -4.2   -4.1 -
Comment on attachment 491383 [details] [diff] [review]
A few more optimizations

I would consider making the replace() methods private and friending the trusted callers of it (Array, maybe Vector, nothing else).
Attachment #491383 - Flags: review?(edwsmith) → review+
(In reply to comment #31)
> I would consider making the replace() methods private and friending the trusted
> callers of it (Array, maybe Vector, nothing else).

Seems reasonable, I'll do that.

This entire patch queue is pretty close to landing-worthy IMHO, but (aside from the lack of formal R+) Lars has asked me to hold off pending some exactGC work; I'll wait for his say-so before landing, but in the meantime I'm going to ask for the "F+" to be upgraded to R+...
Attachment #489711 - Flags: review?(edwsmith)
Attachment #489851 - Flags: review?(edwsmith)
Attachment #489711 - Flags: review?(edwsmith)
Attachment #489851 - Flags: review?(edwsmith)
Comment on attachment 488618 [details] [diff] [review]
Refactor "generic" array methods in ArrayClass to remove friend access

Documentation on ScriptObject::toArrayObject is incorrect, it says it returns "true if this is an ArrayObject" but it returns a pointer.  (Also "return" should be "returns".)

The generic implementation of ScriptObject::array_concat appears incorrect, because it transfers 'undefined' values where the source array has a hole (missing property).  Note that E262-3 says that the 'this' object of array_concat need not be an Array object.

Same goes for array_reverse and array_slice.

(I stopped looking at this point; I have not reviewed the rest of ScriptObject.cpp, and pretty much none of the changes in ArrayClass.cpp.)

I have a hard time seeing the utility of the refactoring.  The behavior of the generic methods is invariant with respect to the type of the 'this' object.  The implementation varies because Array and Vector have other representations, but Vector already has its own implementations for the most part; it would have seemed more surgical to me to simply make the generic_X methods deal with the two different implementations on two different code paths.

Minor issues found while reviewing:

Documentation on ScriptObject::getLengthProperty pointlessly brings up ArrayObject, when it should just state that the method reads the "length" property of any object.  However, the API does not make sense for that since the "length" property may be undefined on some objects, so something needs to be said about that.

About setLengthProperty, it's not clear what happens if "length" is a typed property that does not admit uint32_t - is the value coerced or is it an error?

Documentation for array methods in ScriptObject.h needs to be capitalized.
Attachment #488618 - Flags: review?(lhansen) → review-
(In reply to comment #33)
> I have a hard time seeing the utility of the refactoring.  The behavior of the
> generic methods is invariant with respect to the type of the 'this' object. 
> The implementation varies because Array and Vector have other representations,
> but Vector already has its own implementations for the most part; it would have
> seemed more surgical to me to simply make the generic_X methods deal with the
> two different implementations on two different code paths.

This was definitely scope creep, but the initial motivation for this was that the ArrayClass implementations had special-casing for ArrayObjects in order to deal with "dense arrays", but this approach required a lot of special knowledge to be promulgated outside ArrayObject proper. Granted, ArrayClass is fairly friendly but nevertheless it seemed that such friendliness could be minimized further (which this patch accomplished).

The defects and nits you point out can obviously be corrected, but I'd like guidance as to whether you oppose the refactoring in general or just question whether such a drastic change is necessary... no point in me expending effort on improving a patch if there's no chance of it being approved.
(In reply to comment #34)
> 
> The defects and nits you point out can obviously be corrected, but I'd like
> guidance as to whether you oppose the refactoring in general or just question
> whether such a drastic change is necessary... no point in me expending effort
> on improving a patch if there's no chance of it being approved.

I don't oppose it as such but I definitely question the drastic change, as you say.  I don't understand why the operations have to be virtual and I'm pretty sure I would not have done it that way - the array operations are specified one way for all data types, and need to have at most two implementation in the system at this time; I don't think subclasses ought to be able to override anything.  (And of course I oppose what I believe is incorrect implementations of the generic Array operations in ScriptObject, but that's somewhat orthogonal maybe.)
(In reply to comment #35)
> I don't oppose it as such but I definitely question the drastic change, as you
> say.  

OK, I'll revisit this and see if a less drastic change can be made to co-exist.
Combined & revised to use a generally more surgical approach to the generics; otherwise mostly a rebased version of the previous patch series.

BUT: cleanup this time revealed that generic_shift wasn't honoring spoofed length property properly; we had an acceptance test for it, but said test was wrong. (This will probably require a followup bug to unfix the old behavior in a versioned way; I'd prefer to land this with the "proper" behavior rather than mix in BugCompatibility changes.) (Note, no security risk here, as we never attempted to use the spoofed value.)
Attachment #488618 - Attachment is obsolete: true
Attachment #489711 - Attachment is obsolete: true
Attachment #489851 - Attachment is obsolete: true
Attachment #491383 - Attachment is obsolete: true
Attachment #498475 - Flags: review?(lhansen)
Comment on attachment 498475 [details] [diff] [review]
Revised & Combined Patch

removeAt() should have an assertion for !isEmpty().  (I know the callers do too but the invariant is actually important only in removeAt.)

The use of the word "enable" in the comment on the definition of NO_DEBUG_ARRAY_VERIFY is very strange given the negative name.  I think simply commenting out the line instead of prefixing the name with "NO_" would make the point much better, it's what we do everywhere else I think.  Accident or deliberate?

The definition of DENSE_ARRAY_HOLE is reasonable but it's not reasonable to have it here without additional documentation on the Atom documentation that undefined values cannot carry additional payload (which is what allows you to assume that here).  Also it would be most excellent to add documentation there that you're using that facility here, so that we won't have to hunt for it when we redo the atom representations eventually, as we must.

Of course the implementations of "generic" operations (eg reverse, concat) are completely wrong according to the ES spec - they do not preserve holes - and this is only made worse by the correct documentation being present in our source code.  But it appears you make them no worse than they were, so what can I say?  I'll file a bug if one is not filed already...
Attachment #498475 - Flags: review?(lhansen) → review+
(In reply to comment #38)
> Of course the implementations of "generic" operations (eg reverse, concat) are
> completely wrong according to the ES spec - they do not preserve holes - and
> this is only made worse by the correct documentation being present in our
> source code.  But it appears you make them no worse than they were, so what can
> I say?  I'll file a bug if one is not filed already...

To be sure I understand: the generic operations are incorrect according to ES spec? As long as my changes preserve this incorrect behavior, then we're all good. (Fixing the incorrect behavior will have to be versioned, of course, and I'm not aware that there is a bug on this.)
(In reply to comment #39)
> 
> To be sure I understand: the generic operations are incorrect according to ES
> spec?

At least some of them, but I have not looked at all.

> As long as my changes preserve this incorrect behavior, then we're all
> good. (Fixing the incorrect behavior will have to be versioned, of course, and
> I'm not aware that there is a bug on this.)

Yes.  I filed bug #620651 to track the problem.
pushed with the relevant nits fixed: 5713:9c0aeb405ad3
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: