Bug 14132 - array sort with > 10000 elements sets elements > 10000 undefined
Summary: array sort with > 10000 elements sets elements > 10000 undefined
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 523.x (Safari 3)
Hardware: PC All
: P1 Major
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-13 18:46 PDT by Mitch Skinner
Modified: 2007-06-13 22:09 PDT (History)
1 user (show)

See Also:


Attachments
test case (1.51 KB, text/html)
2007-06-13 18:49 PDT, Mitch Skinner
no flags Details
patch with test case and change log (6.83 KB, patch)
2007-06-13 22:00 PDT, Darin Adler
mrowe: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mitch Skinner 2007-06-13 18:46:51 PDT
Sorting arrays with more than 10,000 elements leaves elements beyond 10,000 undefined.  Loading the attached html file in Safari 2 and 3 (419.3 on OS X 10.4.8 and 522.11.3 on Windows XP) gives me the following:


Test Result

test length: 10010
test[9999]: 9999
test[10000]: 10000
test[9990:10010]: [9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999, 10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009]

sorting array

test length: 10010
test[9999]: 9999
test[10000]: undefined
test[9990:10010]: [9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999, , , , , , , , , , ]


While Firefox and IE both give me:


Test Result

test length: 10010
test[9999]: 9999
test[10000]: 10000
test[9990:10010]: [9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999, 10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009]

sorting array

test length: 10010
test[9999]: 9999
test[10000]: 10000
test[9990:10010]: [9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999, 10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009]
Comment 1 Mitch Skinner 2007-06-13 18:49:53 PDT
Created attachment 15012 [details]
test case
Comment 2 Mark Rowe (bdash) 2007-06-13 20:59:04 PDT
From memory, at around 10,000 elements we change both sorting algorithm and move to a sparse array implementation.  Either one of these may be the root of this issue.
Comment 3 Mark Rowe (bdash) 2007-06-13 21:09:39 PDT
I'll have a look into this.
Comment 4 Darin Adler 2007-06-13 22:00:57 PDT
Created attachment 15013 [details]
patch with test case and change log
Comment 5 Darin Adler 2007-06-13 22:09:48 PDT
Committed revision 23521.