WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
161867
Web Inspector: Use Array.shallowEqual instead of Object.shallowEqual in more places
https://bugs.webkit.org/show_bug.cgi?id=161867
Summary
Web Inspector: Use Array.shallowEqual instead of Object.shallowEqual in more ...
Matt Baker
Reported
2016-09-12 10:24:53 PDT
Summary: Use Array.shallowEqual instead of Object.shallowEqual in more places. Crude perf testing shows the Array version to be ~30x faster. Array.shallowEqual should also check the type of its arguments before checking for equality. The following currently return true: Array.shallowEqual(null, null) Array.shallowEqual("abc", "abc") Array.shallowEqual(1.23, 1.23) ...
Attachments
[Patch] Proposed Fix
(10.51 KB, patch)
2016-09-12 10:28 PDT
,
Matt Baker
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews101 for mac-yosemite
(1.05 MB, application/zip)
2016-09-12 11:25 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews112 for mac-yosemite
(1.48 MB, application/zip)
2016-09-12 11:30 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews104 for mac-yosemite-wk2
(886.24 KB, application/zip)
2016-09-12 11:38 PDT
,
Build Bot
no flags
Details
[Patch] Proposed Fix
(12.71 KB, patch)
2016-09-12 11:57 PDT
,
Matt Baker
no flags
Details
Formatted Diff
Diff
[Patch] Proposed Fix
(13.06 KB, patch)
2016-09-12 13:35 PDT
,
Matt Baker
no flags
Details
Formatted Diff
Diff
[Patch] For Landing
(21.26 KB, patch)
2016-09-13 12:41 PDT
,
Matt Baker
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-09-12 10:25:06 PDT
<
rdar://problem/28261328
>
Matt Baker
Comment 2
2016-09-12 10:28:20 PDT
Created
attachment 288579
[details]
[Patch] Proposed Fix
Build Bot
Comment 3
2016-09-12 11:25:10 PDT
Comment on
attachment 288579
[details]
[Patch] Proposed Fix
Attachment 288579
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.webkit.org/results/2060313
New failing tests: inspector/unit-tests/array-utilities.html
Build Bot
Comment 4
2016-09-12 11:25:13 PDT
Created
attachment 288590
[details]
Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 5
2016-09-12 11:30:49 PDT
Comment on
attachment 288579
[details]
[Patch] Proposed Fix
Attachment 288579
[details]
did not pass mac-debug-ews (mac): Output:
http://webkit-queues.webkit.org/results/2060311
New failing tests: inspector/unit-tests/array-utilities.html
Build Bot
Comment 6
2016-09-12 11:30:53 PDT
Created
attachment 288592
[details]
Archive of layout-test-results from ews112 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 7
2016-09-12 11:38:00 PDT
Comment on
attachment 288579
[details]
[Patch] Proposed Fix
Attachment 288579
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.webkit.org/results/2060363
New failing tests: inspector/unit-tests/array-utilities.html
Build Bot
Comment 8
2016-09-12 11:38:03 PDT
Created
attachment 288593
[details]
Archive of layout-test-results from ews104 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Matt Baker
Comment 9
2016-09-12 11:57:35 PDT
Created
attachment 288596
[details]
[Patch] Proposed Fix
Devin Rousso
Comment 10
2016-09-12 13:19:12 PDT
Comment on
attachment 288596
[details]
[Patch] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=288596&action=review
> Source/WebInspectorUI/UserInterface/Base/Utilities.js:439 > + if (!(a instanceof Array) || !(b instanceof Array))
Why not just use Array.isArray()?
Matt Baker
Comment 11
2016-09-12 13:30:47 PDT
(In reply to
comment #10
)
> Comment on
attachment 288596
[details]
> [Patch] Proposed Fix > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=288596&action=review
> > > Source/WebInspectorUI/UserInterface/Base/Utilities.js:439 > > + if (!(a instanceof Array) || !(b instanceof Array)) > > Why not just use Array.isArray()?
`instanceof Array` is far more prevalent in the inspector, but apparently has some shortcomings addressed by `Array.isArray()`:
http://web.mit.edu/jwalden/www/isArray.html
. I think it has nicer syntax too. Will change.
Matt Baker
Comment 12
2016-09-12 13:35:16 PDT
Created
attachment 288606
[details]
[Patch] Proposed Fix
Joseph Pecoraro
Comment 13
2016-09-13 11:22:14 PDT
Comment on
attachment 288606
[details]
[Patch] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=288606&action=review
r=me
> LayoutTests/inspector/unit-tests/array-utilities.html:102 > + InspectorTest.expectThat(Array.shallowEqual(new Array(...arr1), new Array(...arr1)), "shallowEqual of equal arrays should be true."); > + InspectorTest.expectThat(Array.shallowEqual(new Array(...arr1), arr1), "shallowEqual of equal arrays should be true.");
Would it be clearer writing these as [...arr1]? I don't thin we ever use the Array constructor, and I did a double take.
Matt Baker
Comment 14
2016-09-13 12:00:57 PDT
Comment on
attachment 288606
[details]
[Patch] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=288606&action=review
>> LayoutTests/inspector/unit-tests/array-utilities.html:102 >> + InspectorTest.expectThat(Array.shallowEqual(new Array(...arr1), arr1), "shallowEqual of equal arrays should be true."); > > Would it be clearer writing these as [...arr1]? I don't thin we ever use the Array constructor, and I did a double take.
I'll remove or rewrite the tests that use the Array constructor.
Matt Baker
Comment 15
2016-09-13 12:33:30 PDT
I'm also going to replace this function used by the Array.prototype.partition test: let quickEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b); with: Array.shallowEqual, which is faster.
Matt Baker
Comment 16
2016-09-13 12:41:56 PDT
Created
attachment 288718
[details]
[Patch] For Landing
WebKit Commit Bot
Comment 17
2016-09-13 13:14:13 PDT
Comment on
attachment 288718
[details]
[Patch] For Landing Clearing flags on attachment: 288718 Committed
r205872
: <
http://trac.webkit.org/changeset/205872
>
WebKit Commit Bot
Comment 18
2016-09-13 13:14:18 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug