Bug 176227

Summary: Speedometer: Reduce duplication in react-redux test
Product: WebKit Reporter: Mathias Bynens <mathias>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: addyo, buildbot, cdumez, commit-queue, gsathya, mathias, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 172339    
Attachments:
Description Flags
Patch none

Description Mathias Bynens 2017-09-01 09:28:43 PDT
The generated bundle includes the same `Object.assign` polyfill five or six times.

In the source code, we’re using object spread in six different places:

    $ grep -r '{\.\.\.' src
    src/components/Footer.spec.js:  renderer.render(<Footer {...props} />)
    src/components/Header.spec.js:  renderer.render(<Header {...props} />)
    src/components/MainSection.js:            <TodoItem key={todo.id} todo={todo} {...actions} />
    src/components/MainSection.spec.js:  renderer.render(<MainSection {...props} />)
    src/components/TodoItem.spec.js:    <TodoItem {...props} />
    src/components/TodoTextInput.spec.js:    <TodoTextInput {...props} />

At build time, Babel transpiles this down to `Object.assign`, relying on the polyfill.

We should find out why the polyfill is not deduplicated correctly.
Comment 1 Mathias Bynens 2017-09-07 10:03:42 PDT
Created attachment 320122 [details]
Patch
Comment 2 Addy Osmani 2017-09-07 10:16:39 PDT
It appears with the latest patch that the problem is no longer an issue (react-scripts may have discovered upstream that there were dupes caused by their build pipeline). The changes in the latest work here LGTM. Deferring to Ryosuke.
Comment 3 Ryosuke Niwa 2017-09-10 17:28:22 PDT
Safari 10.1.2 (12603.3.8)

Patched:
35.0 ± 0.71
33.4 ± 1.0
35.2 ± 1.4
34.8 ± 0.8
36.4 ± 1.1
35.9 ± 0.77

Unpatched:
33.3 ± 2.6
35.4 ± 0.99
35.5 ± 0.84
36.0 ± 0.99
35.5 ± 2.4
35.3 ± 0.66

Chrome 61.0.3163.79

Patched:
44.6 ± 1.5
43.8 ± 1.6
41.0 ± 3.2
43.5 ± 1.9
43.7 ± 1.8
44.7 ± 1.3

Unpatched:
43.8 ± 3.7
44.1 ± 1.5
46.3 ± 1.8
45.6 ± 1.6
46.3 ± 2.4
45.5 ± 1.4
Comment 4 Ryosuke Niwa 2017-09-10 17:29:08 PDT
Comment on attachment 320122 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2017-09-10 18:01:02 PDT
Comment on attachment 320122 [details]
Patch

Clearing flags on attachment: 320122

Committed r221841: <http://trac.webkit.org/changeset/221841>
Comment 6 WebKit Commit Bot 2017-09-10 18:01:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2017-09-27 12:45:41 PDT
<rdar://problem/34693898>