RESOLVED FIXED 118914
Setting a large numeric property on an object causes it to allocate a huge backing store
https://bugs.webkit.org/show_bug.cgi?id=118914
Summary Setting a large numeric property on an object causes it to allocate a huge ba...
Mark Hahnenberg
Reported 2013-07-19 11:46:10 PDT
There are two distinct actions that we're trying to optimize for: new Array(100000); and: a = []; a[100000] = 42; In the first case, the programmer has indicated that they expect this Array to be very big, so they should get a contiguous array up until some threshold, above which we perform density calculations to see if it is indeed dense enough to warrant being contiguous. In the second case, the programmer hasn't indicated anything about the size of the Array, so we should be more conservative and assume it should be sparse until we've proven otherwise. Currently both of those cases are handled by MIN_SPARSE_ARRAY_INDEX. We should distinguish between them for the purposes of not over-allocating large backing stores like we see on http://www.peekanalytics.com/burgerjoints/ The way that we'll do this is to keep the MIN_SPARSE_ARRAY_INDEX for the first case, and introduce a new heuristic for the second case. If we are putting to an index above a certain threshold (say, 1000) and it is beyond the length of the array, then we will use a sparse map instead. So for example, in the second case above the empty array has a blank indexing type and a length of 0. We put-by-val to an index > 1000 and > a.length, so we'll use a sparse map.
Attachments
Patch (8.72 KB, patch)
2013-07-19 12:07 PDT, Mark Hahnenberg
ggaren: review+
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion (770.15 KB, application/zip)
2013-07-19 13:28 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 (841.19 KB, application/zip)
2013-07-19 16:09 PDT, Build Bot
no flags
Archive of layout-test-results from APPLE-EWS-5 for win-future (264.23 KB, application/zip)
2013-07-26 09:06 PDT, Build Bot
no flags
Mark Hahnenberg
Comment 1 2013-07-19 12:07:59 PDT
Mark Hahnenberg
Comment 2 2013-07-19 12:09:26 PDT
This patch is neutral on all other benchmarks we track.
Mark Hahnenberg
Comment 3 2013-07-19 12:26:00 PDT
Still need to add test expectations for regression test.
Geoffrey Garen
Comment 4 2013-07-19 13:10:23 PDT
Comment on attachment 207135 [details] Patch r=me
Build Bot
Comment 5 2013-07-19 13:28:38 PDT
Comment on attachment 207135 [details] Patch Attachment 207135 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/1131309 New failing tests: fast/js/regress/put-by-val-large-index-blank-indexing-type.html
Build Bot
Comment 6 2013-07-19 13:28:40 PDT
Created attachment 207141 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.3
Build Bot
Comment 7 2013-07-19 16:09:48 PDT
Comment on attachment 207135 [details] Patch Attachment 207135 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/1131351 New failing tests: fast/js/regress/put-by-val-large-index-blank-indexing-type.html
Build Bot
Comment 8 2013-07-19 16:09:49 PDT
Created attachment 207157 [details] Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-13 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.3
Build Bot
Comment 9 2013-07-26 09:06:03 PDT
Comment on attachment 207135 [details] Patch Attachment 207135 [details] did not pass win-ews (win): Output: http://webkit-queues.appspot.com/results/1247234 New failing tests: dom/xhtml/level1/core/documentinvalidcharacterexceptioncreateentref1.xhtml dom/svg/level3/xpath/XPathEvaluator_evaluate_INVALID_EXPRESSION_ERR.svg dom/html/level2/events/dispatchEvent04.html dom/html/level2/html/HTMLSelectElement20.html dom/svg/level3/xpath/XPathEvaluator_createExpression_INVALID_EXPRESSION_ERR.svg dom/svg/level3/xpath/XPathEvaluator_createExpression_NAMESPACE_ERR_02.svg dom/html/level1/core/documentinvalidcharacterexceptioncreateentref.html dom/html/level2/core/hc_namednodemapinvalidtype1.html dom/svg/level3/xpath/XPathEvaluator_evaluate_NAMESPACE_ERR.svg dom/html/level2/events/dispatchEvent01.html dom/xhtml/level1/core/hc_attrappendchild4.xhtml dom/html/level2/events/dispatchEvent03.html dom/html/level2/events/dispatchEvent02.html dom/html/level2/core/createDocumentType04.html dom/html/level1/core/documentinvalidcharacterexceptioncreateentref1.html dom/html/level1/core/documentinvalidcharacterexceptioncreatepi1.html dom/html/level2/events/dispatchEvent06.html css1/basic/comments.html dom/xhtml/level1/core/documentinvalidcharacterexceptioncreatepi1.xhtml dom/html/level2/events/dispatchEvent07.html dom/html/level2/core/setAttributeNS10.html dom/html/level2/events/dispatchEvent05.html dom/html/level1/core/hc_attrappendchild2.html dom/html/level2/core/createAttributeNS06.html dom/html/level1/core/hc_attrappendchild4.html dom/xhtml/level1/core/documentinvalidcharacterexceptioncreatepi.xhtml dom/svg/level3/xpath/XPathEvaluator_createExpression_NAMESPACE_ERR_01.svg dom/xhtml/level1/core/documentinvalidcharacterexceptioncreateentref.xhtml dom/xhtml/level1/core/hc_attrappendchild2.xhtml dom/html/level1/core/documentinvalidcharacterexceptioncreatepi.html
Build Bot
Comment 10 2013-07-26 09:06:05 PDT
Created attachment 207530 [details] Archive of layout-test-results from APPLE-EWS-5 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: APPLE-EWS-5 Port: win-future Platform: CYGWIN_NT-6.1-WOW64-1.7.20-0.266-5-3-i686-32bit
Mark Hahnenberg
Comment 11 2013-07-26 11:06:21 PDT
Geoffrey Garen
Comment 12 2013-07-26 12:32:44 PDT
David Kilzer (:ddkilzer)
Comment 13 2013-08-13 14:10:02 PDT
Note You need to log in before you can comment on or make changes to this bug.