RESOLVED FIXED 42857
Inefficient Handling of Shift and Unshift
https://bugs.webkit.org/show_bug.cgi?id=42857
Summary Inefficient Handling of Shift and Unshift
Michael Saboff
Reported 2010-07-22 16:32:15 PDT
The array code sometimes re-allocates and always copies data when performing shift and unshift operations. This defect is related to <rdar://problem/8086123> 12x slower than Chrome on Dromaeo JS arrays test.
Attachments
Patch file (56.48 KB, patch)
2010-07-22 16:49 PDT, Michael Saboff
barraclough: review-
Updated patch (55.84 KB, patch)
2010-07-27 15:33 PDT, Michael Saboff
barraclough: review+
Michael Saboff
Comment 1 2010-07-22 16:49:10 PDT
Created attachment 62360 [details] Patch file Patch to improve performance of shift, unshift and special cases of splice and slice. Also includes some optimizations to array initialization and growth.
Gavin Barraclough
Comment 2 2010-07-26 16:17:25 PDT
Comment on attachment 62360 [details] Patch file Please revert unnecessary change to JavaScriptCore/Configurations/JavaScriptCore.xcconfig. There are a couple of these: BaseIndex(regT2, regT1, ScalePtr, 0) You should just remove the last ",0", this is not necessary. In JSArray.h, typo: "qucik" "return (ArrayStorage *)((char*)" - these should be c++ style casts. in ArrayPrototype.cpp: We have a coding style rule that we don't use abbreviations, unless it is canonically understood. I don't think the 'nr' in nrArgs matches the style in the codebase well, and I think it falls foul of this rule. We do commonly use the abbreviations 'args' and 'num' for number. I'd suggest numArgs, numberOfArgs, argsCount, etc could all be acceptable, but I think 'nr' should change. I'd also prefer 'index' to 'k' as the loop counter, but single character loop index names clearly has precedent. Otherwise, all looks great – normally I'd r+, but I'll r- despite the small number of changes since you'll be needing to put up a new patch for the commit-queue anyway.
Gavin Barraclough
Comment 3 2010-07-27 12:30:42 PDT
Hrrrrm. I missed that this was from existing code. I don't think nrArgs is great, so personally I'd prefer these were changed – but since it's existing code I won't require this for an r+, I'll leave this up to your judgement.
Michael Saboff
Comment 4 2010-07-27 15:33:22 PDT
Created attachment 62757 [details] Updated patch Fixed issues from review. Did not change variables named nrArgs as this is from prior code.
Gavin Barraclough
Comment 5 2010-07-27 16:26:47 PDT
Transmitting file data ...... Committed revision 64177.
Gavin Barraclough
Comment 6 2010-07-27 22:39:45 PDT
QT ARM/Win builds are running into the following problem: "..\..\..\JavaScriptCore\runtime\ArrayPrototype.cpp:41: error: size of array 'dummyclass_fits_in_cell' is negative" Temporarily reverting this patch (in http://trac.webkit.org/changeset/64184 ) while we work out what our options are here.
Gavin Barraclough
Comment 7 2010-07-27 22:40:25 PDT
reopening
Gavin Barraclough
Comment 8 2010-07-29 16:29:45 PDT
Relanded in revision 64320.
Note You need to log in before you can comment on or make changes to this bug.