Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relationship Refactor (part 2): The graph should coordinate state updates #7493

Merged
merged 6 commits into from
May 4, 2021

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Apr 30, 2021

Basic premise here is that the individual edges can't optimize updating their inverses, state, or notifying the UI efficiently while the graph, acting as a coordinator, can.

The existing explosion of "remove" and "add" spaghetti (roughly 12 different methods for removing a record from one side last I counted) was primarily due to attempting to prevent "cycling" (an update to one side updating it's inverse which then sends the same updates back to the originating side, potentially bouncing multiple times). These efforts were mostly in vain and we often cycle multiple times even in a first load scenario.

When this PR completes, we should be left in a state of updating the various edges while only visiting each once per relationship payload received (note: a json-api payload will typically contain multiple relationship payloads for the same relationship, so this does not yet do any work to avoid that double pass).

@runspired runspired changed the base branch from runspired/simpler-relationships to master April 30, 2021 02:31
@github-actions
Copy link

github-actions bot commented Apr 30, 2021

Asset Size Report for a34fcdf

IE11 Builds

✅ EmberData shrank by -3.6 KB (-63.0 B compressed)

Warnings

⚠️ The uncompressed size of the package @ember-data/store has increased by +189.0 B.
⚠️ The uncompressed size of the package @ember-data/model has increased by +130.0 B.

Changeset


EmberData +182.25 KB -3.6 KB (+37.71 KB -63.0 B compressed)
    @ember-data/store +78.15 KB +189.0 B (+16.17 KB +3.23 B compressed)
        @ember-data/store/-private +77.24 KB +189.0 B (+15.98 KB +3.23 B compressed)
    @ember-data/record-data +24.97 KB -3.91 KB (+5.17 KB -68.46 B compressed)
        @ember-data/record-data/-private +24.97 KB -3.91 KB (+5.17 KB -68.46 B compressed)
    @ember-data/model +19.46 KB +130.0 B (+4.03 KB +2.22 B compressed)
        @ember-data/model/-private +18.98 KB +130.0 B (+3.93 KB +2.22 B compressed)

Full Asset Analysis (IE11)

Asset Size Report
=================


Library: EmberData
┌────────────┬─────────────┐
│  (index)   │   Values    │
├────────────┼─────────────┤
│   bytes    │ '182.25 KB' │
│ compressed │ '37.71 KB'  │
│  packages  │      8      │
│  modules   │     44      │
└────────────┴─────────────┘

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '78.15 KB' │
│  compressed  │ '16.17 KB' │
│ % Of Library │   '42.9'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 77.24 KB  | 15.98 KB   | 98.8          | 42.4
	@ember-data/store/index                           | 936.00 B  | 193.65 B   | 1.2           | 0.5

Package: @ember-data/record-data
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '24.97 KB' │
│  compressed  │ '5.17 KB'  │
│ % Of Library │   '13.7'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/record-data/-private                  | 24.97 KB  | 5.17 KB    | 100.0         | 13.7

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '20.84 KB' │
│  compressed  │ '4.31 KB'  │
│ % Of Library │   '11.4'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                       | 7.75 KB   | 1.60 KB    | 37.2          | 4.2
	@ember-data/serializer/-private                   | 5.69 KB   | 1.18 KB    | 27.3          | 3.1
	@ember-data/serializer/json-api                   | 3.95 KB   | 836.48 B   | 18.9          | 2.2
	@ember-data/serializer/rest                       | 3.00 KB   | 634.76 B   | 14.4          | 1.6
	@ember-data/serializer/index                      | 258.00 B  | 53.37 B    | 1.2           | 0.1
	@ember-data/serializer/transform                  | 215.00 B  | 44.48 B    | 1.0           | 0.1

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '19.46 KB' │
│  compressed  │ '4.03 KB'  │
│ % Of Library │   '10.7'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 18.98 KB  | 3.93 KB    | 97.6          | 10.4
	@ember-data/model/index                           | 486.00 B  | 100.55 B   | 2.4           | 0.3

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '18.47 KB' │
│  compressed  │ '3.82 KB'  │
│ % Of Library │   '10.1'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                          | 9.31 KB   | 1.93 KB    | 50.4          | 5.1
	@ember-data/adapter/-private                      | 3.80 KB   | 806.07 B   | 20.6          | 2.1
	@ember-data/adapter/error                         | 1.95 KB   | 412.55 B   | 10.5          | 1.1
	@ember-data/adapter/index                         | 1.81 KB   | 382.75 B   | 9.8           | 1.0
	@ember-data/adapter/json-api                      | 1.60 KB   | 339.72 B   | 8.7           | 0.9

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '9.24 KB' │
│  compressed  │ '1.91 KB' │
│ % Of Library │   '5.1'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.32 KB   | 492.20 B   | 25.1          | 1.3
	ember-data/-private                               | 1.98 KB   | 419.79 B   | 21.4          | 1.1
	ember-data/adapters/errors                        | 1.19 KB   | 251.79 B   | 12.9          | 0.7
	ember-data/setup-container                        | 503.00 B  | 104.06 B   | 5.3           | 0.3
	ember-data/relationships                          | 318.00 B  | 65.79 B    | 3.4           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 56.68 B    | 2.9           | 0.1
	ember-data/serializers/json-api                   | 251.00 B  | 51.93 B    | 2.7           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 50.68 B    | 2.6           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 50.27 B    | 2.6           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 50.27 B    | 2.6           | 0.1
	ember-data/transform                              | 241.00 B  | 49.86 B    | 2.5           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 49.03 B    | 2.5           | 0.1
	ember-data/serializer                             | 232.00 B  | 48.00 B    | 2.5           | 0.1
	ember-data/adapter                                | 226.00 B  | 46.75 B    | 2.4           | 0.1
	ember-data/model                                  | 222.00 B  | 45.93 B    | 2.3           | 0.1
	ember-data/store                                  | 222.00 B  | 45.93 B    | 2.3           | 0.1
	ember-data/attr                                   | 218.00 B  | 45.10 B    | 2.3           | 0.1
	ember-data/version                                | 162.00 B  | 33.51 B    | 1.7           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '8.15 KB' │
│  compressed  │ '1.69 KB' │
│ % Of Library │   '4.5'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 3.11 KB   | 658.75 B   | 38.1          | 1.7
	ember-inflector/lib/helpers/pluralize             | 1.62 KB   | 343.03 B   | 19.9          | 0.9
	ember-inflector/lib/system/inflections            | 1.59 KB   | 336.62 B   | 19.5          | 0.9
	ember-inflector/index                             | 473.00 B  | 97.86 B    | 5.7           | 0.3
	ember-inflector/lib/system                        | 471.00 B  | 97.44 B    | 5.6           | 0.3
	ember-inflector/lib/system/string                 | 332.00 B  | 68.68 B    | 4.0           | 0.2
	ember-inflector/lib/utils/make-helper             | 308.00 B  | 63.72 B    | 3.7           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 61.24 B    | 3.5           | 0.2

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.96 KB'  │
│  compressed  │ '627.10 B' │
│ % Of Library │   '1.6'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                           | 2.47 KB   | 523.65 B   | 83.5          | 1.4
	@ember-data/debug/setup                           | 500.00 B  | 103.44 B   | 16.5          | 0.3

Modern Builds

☑️ EmberData shrank by -2.57 KB but the compressed size increased slighty (+132.0 B compressed)

Warnings

⚠️ The uncompressed size of the package @ember-data/store has increased by +164.0 B.
⚠️ The uncompressed size of the package @ember-data/model has increased by +111.0 B.

Changeset


EmberData +163.13 KB -2.57 KB (+35.7 KB +132.0 B compressed)
    @ember-data/store +69.02 KB +164.0 B (+15.1 KB -8.23 B compressed)
        @ember-data/store/-private +68.1 KB +164.0 B (+14.9 KB -8.23 B compressed)
    @ember-data/record-data +23.02 KB -2.84 KB (+5.04 KB +145.81 B compressed)
        @ember-data/record-data/-private +23.02 KB -2.84 KB (+5.04 KB +145.81 B compressed)
    @ember-data/model +17.12 KB +111.0 B (+3.75 KB -5.57 B compressed)
        @ember-data/model/-private +16.65 KB +111.0 B (+3.64 KB -5.57 B compressed)

Full Asset Analysis (Modern)

Asset Size Report
=================


Library: EmberData
┌────────────┬─────────────┐
│  (index)   │   Values    │
├────────────┼─────────────┤
│   bytes    │ '163.13 KB' │
│ compressed │ '35.70 KB'  │
│  packages  │      8      │
│  modules   │     44      │
└────────────┴─────────────┘

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '69.02 KB' │
│  compressed  │ '15.10 KB' │
│ % Of Library │   '42.3'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 68.10 KB  | 14.90 KB   | 98.7          | 41.7
	@ember-data/store/index                           | 936.00 B  | 204.80 B   | 1.3           | 0.6

Package: @ember-data/record-data
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '23.02 KB' │
│  compressed  │ '5.04 KB'  │
│ % Of Library │   '14.1'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/record-data/-private                  | 23.02 KB  | 5.04 KB    | 100.0         | 14.1

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '19.37 KB' │
│  compressed  │ '4.24 KB'  │
│ % Of Library │   '11.9'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                       | 7.12 KB   | 1.56 KB    | 36.8          | 4.4
	@ember-data/serializer/-private                   | 5.37 KB   | 1.18 KB    | 27.7          | 3.3
	@ember-data/serializer/json-api                   | 3.72 KB   | 832.78 B   | 19.2          | 2.3
	@ember-data/serializer/rest                       | 2.71 KB   | 607.84 B   | 14.0          | 1.7
	@ember-data/serializer/index                      | 243.00 B  | 53.17 B    | 1.2           | 0.1
	@ember-data/serializer/transform                  | 215.00 B  | 47.04 B    | 1.1           | 0.1

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '17.12 KB' │
│  compressed  │ '3.75 KB'  │
│ % Of Library │   '10.5'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 16.65 KB  | 3.64 KB    | 97.2          | 10.2
	@ember-data/model/index                           | 486.00 B  | 106.34 B   | 2.8           | 0.3

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '16.02 KB' │
│  compressed  │ '3.51 KB'  │
│ % Of Library │   '9.8'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                          | 8.37 KB   | 1.83 KB    | 52.2          | 5.1
	@ember-data/adapter/-private                      | 3.58 KB   | 803.02 B   | 22.4          | 2.2
	@ember-data/adapter/error                         | 1.91 KB   | 428.64 B   | 11.9          | 1.2
	@ember-data/adapter/index                         | 1.14 KB   | 254.69 B   | 7.1           | 0.7
	@ember-data/adapter/json-api                      | 1.02 KB   | 228.21 B   | 6.4           | 0.6

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '9.24 KB' │
│  compressed  │ '2.02 KB' │
│ % Of Library │   '5.7'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.32 KB   | 520.54 B   | 25.1          | 1.4
	ember-data/-private                               | 1.98 KB   | 443.96 B   | 21.4          | 1.2
	ember-data/adapters/errors                        | 1.19 KB   | 266.28 B   | 12.9          | 0.7
	ember-data/setup-container                        | 503.00 B  | 110.06 B   | 5.3           | 0.3
	ember-data/relationships                          | 318.00 B  | 69.58 B    | 3.4           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 59.95 B    | 2.9           | 0.2
	ember-data/serializers/json-api                   | 251.00 B  | 54.92 B    | 2.7           | 0.2
	ember-data/adapters/json-api                      | 245.00 B  | 53.60 B    | 2.6           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 53.17 B    | 2.6           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 53.17 B    | 2.6           | 0.1
	ember-data/transform                              | 241.00 B  | 52.73 B    | 2.5           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 51.85 B    | 2.5           | 0.1
	ember-data/serializer                             | 232.00 B  | 50.76 B    | 2.5           | 0.1
	ember-data/adapter                                | 226.00 B  | 49.45 B    | 2.4           | 0.1
	ember-data/model                                  | 222.00 B  | 48.57 B    | 2.3           | 0.1
	ember-data/store                                  | 222.00 B  | 48.57 B    | 2.3           | 0.1
	ember-data/attr                                   | 218.00 B  | 47.70 B    | 2.3           | 0.1
	ember-data/version                                | 162.00 B  | 35.44 B    | 1.7           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '6.66 KB' │
│  compressed  │ '1.46 KB' │
│ % Of Library │   '4.1'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 2.88 KB   | 645.26 B   | 43.3          | 1.8
	ember-inflector/lib/system/inflections            | 1.59 KB   | 356.00 B   | 23.9          | 1.0
	ember-inflector/index                             | 473.00 B  | 103.49 B   | 6.9           | 0.3
	ember-inflector/lib/system                        | 471.00 B  | 103.05 B   | 6.9           | 0.3
	ember-inflector/lib/helpers/pluralize             | 373.00 B  | 81.61 B    | 5.5           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 69.58 B    | 4.7           | 0.2
	ember-inflector/lib/utils/make-helper             | 308.00 B  | 67.39 B    | 4.5           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 64.76 B    | 4.3           | 0.2

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.70 KB'  │
│  compressed  │ '605.00 B' │
│ % Of Library │   '1.7'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                           | 2.21 KB   | 495.81 B   | 82.0          | 1.4
	@ember-data/debug/setup                           | 499.00 B  | 109.18 B   | 18.0          | 0.3

Modern Builds (No Rollup)

☑️ EmberData shrank by -370.0 B but the compressed size increased slighty (+491.0 B compressed)

Warnings

⚠️ The uncompressed size of the package @ember-data/store has increased by +165.0 B.
⚠️ The uncompressed size of the package @ember-data/model has increased by +111.0 B.

Changeset


EmberData +209.06 KB -370.0 B (+40.52 KB +491.0 B compressed)
    @ember-data/store +99.74 KB +165.0 B (+19.33 KB -218.96 B compressed)
        @ember-data/store/-private/system/core-store +17.05 KB -178.0 B (+3.31 KB +236.21 B compressed)
        @ember-data/store/-private/system/model/internal-model +16.57 KB +139.0 B (+3.21 KB -184.46 B compressed)
        @ember-data/store/-private/system/fetch-manager +4.97 KB +5.0 B (+985.78 B -6.64 B compressed)
        @ember-data/store/-private/system/store/finders +4.42 KB +53.0 B (+877.63 B -70.33 B compressed)
        @ember-data/store/-private/identifiers/cache +3.88 KB +15.0 B (+769.28 B -19.91 B compressed)
        @ember-data/store/-private/system/store/record-data-store-wrapper +3.25 KB -91.0 B (+644.07 B +120.76 B compressed)
        @ember-data/store/-private/system/references/has-many +1.53 KB +75.0 B (+303.52 B -99.53 B compressed)
        @ember-data/store/-private/system/references/belongs-to +1.3 KB +117.0 B (+258.56 B -155.26 B compressed)
        @ember-data/store/-private/system/model/notify-changes +910.0 B +44.0 B (+176.37 B -58.39 B compressed)
        @ember-data/store/-private/system/backburner +239.0 B -14.0 B (+46.32 B +18.58 B compressed)
    @ember-data/record-data +29.76 KB -646.0 B (+5.77 KB +857.26 B compressed)
        @ember-data/record-data/-private/record-data +7.87 KB +129.0 B (+1.53 KB -171.19 B compressed)
        @ember-data/record-data/-private/relationships/state/belongs-to +1.9 KB -3.93 KB (+377.37 B +5.21 KB compressed)
        @ember-data/record-data/-private/relationships/state/relationship 0.0 B -5.62 KB (0.0 B +7.46 KB compressed)
        @ember-data/record-data/-private/relationships/state/has-many +2.19 KB -623.0 B (+435.32 B +826.74 B compressed)
        @ember-data/record-data/-private/graph/-edge-definition +2.81 KB +21.0 B (+557.43 B -27.87 B compressed)
        @ember-data/record-data/-private/graph/index +4.61 KB +2.41 KB (+915.04 B -3.2 KB compressed)
        @ember-data/record-data/-private/ordered-set 0.0 B -1.14 KB (0.0 B +1.52 KB compressed)
        @ember-data/record-data/-private/index +977.0 B -4.0 B (+189.36 B +5.31 B compressed)
        @ember-data/record-data/-private/graph/-utils +1.02 KB +753.0 B (+202.35 B -999.25 B compressed)
        @ember-data/record-data/-private/graph/operations/replace-related-records +2.87 KB +2.87 KB (+568.87 B -3.8 KB compressed)
        @ember-data/record-data/-private/graph/operations/update-relationship +1.42 KB +1.42 KB (+281.04 B -1.88 KB compressed)
        @ember-data/record-data/-private/graph/operations/replace-related-record +979.0 B +979.0 B (+189.75 B -1.27 KB compressed)
        @ember-data/record-data/-private/graph/operations/add-to-related-records +771.0 B +771.0 B (+149.43 B -1023.14 B compressed)
        @ember-data/record-data/-private/relationships/state/implicit +692.0 B +692.0 B (+134.12 B -918.3 B compressed)
        @ember-data/record-data/-private/graph/operations/remove-from-related-records +650.0 B +650.0 B (+125.98 B -862.57 B compressed)
        @ember-data/record-data/-private/graph/-operations +79.0 B +79.0 B (+15.31 B -104.84 B compressed)
    @ember-data/model +20.8 KB +111.0 B (+4.03 KB -147.3 B compressed)
        @ember-data/model/-private/system/many-array +2.45 KB +37.0 B (+485.72 B -49.1 B compressed)
        @ember-data/model/-private/belongs-to +626.0 B +37.0 B (+121.33 B -49.1 B compressed)
        @ember-data/model/-private/has-many +587.0 B +37.0 B (+113.77 B -49.1 B compressed)

Full Asset Analysis (Modern)

Asset Size Report
=================


Library: EmberData
┌────────────┬─────────────┐
│  (index)   │   Values    │
├────────────┼─────────────┤
│   bytes    │ '209.06 KB' │
│ compressed │ '40.52 KB'  │
│  packages  │      8      │
│  modules   │     147     │
└────────────┴─────────────┘

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '99.74 KB' │
│  compressed  │ '19.33 KB' │
│ % Of Library │   '47.7'   │
└──────────────┴────────────┘
	Module                                                                             | Bytes     | Compressed | % of Package  | % Of Library
	--------------------------------------------------------------------------------------------------------------------------------------
	@ember-data/store/-private/system/core-store                                       | 17.05 KB  | 3.31 KB    | 17.1          | 8.2
	@ember-data/store/-private/system/model/internal-model                             | 16.57 KB  | 3.21 KB    | 16.6          | 7.9
	@ember-data/store/-private/system/model/states                                     | 5.47 KB   | 1.06 KB    | 5.5           | 2.6
	@ember-data/store/-private/system/fetch-manager                                    | 4.97 KB   | 985.78 B   | 5.0           | 2.4
	@ember-data/store/-private/system/record-array-manager                             | 4.47 KB   | 886.35 B   | 4.5           | 2.1
	@ember-data/store/-private/system/store/finders                                    | 4.42 KB   | 877.63 B   | 4.4           | 2.1
	@ember-data/store/-private/index                                                   | 4.11 KB   | 815.80 B   | 4.1           | 2.0
	@ember-data/store/-private/identifiers/cache                                       | 3.88 KB   | 769.28 B   | 3.9           | 1.9
	@ember-data/store/-private/system/store/record-data-store-wrapper                  | 3.25 KB   | 644.07 B   | 3.3           | 1.6
	@ember-data/store/-private/system/snapshot                                         | 3.00 KB   | 594.65 B   | 3.0           | 1.4
	@ember-data/store/-private/system/store/internal-model-factory                     | 2.91 KB   | 578.36 B   | 2.9           | 1.4
	@ember-data/store/-private/system/record-arrays/record-array                       | 2.25 KB   | 446.37 B   | 2.3           | 1.1
	@ember-data/store/-private/system/ds-model-store                                   | 1.99 KB   | 395.01 B   | 2.0           | 1.0
	@ember-data/store/-private/system/request-cache                                    | 1.89 KB   | 374.27 B   | 1.9           | 0.9
	@ember-data/store/-private/system/references/has-many                              | 1.53 KB   | 303.52 B   | 1.5           | 0.7
	@ember-data/store/-private/system/schema-definition-service                        | 1.47 KB   | 292.47 B   | 1.5           | 0.7
	@ember-data/store/-private/system/references/belongs-to                            | 1.30 KB   | 258.56 B   | 1.3           | 0.6
	@ember-data/store/-private/system/model/shim-model-class                           | 1.27 KB   | 251.97 B   | 1.3           | 0.6
	@ember-data/store/-private/system/store/serializer-response                        | 1.12 KB   | 223.09 B   | 1.1           | 0.5
	@ember-data/store/-private/identifiers/utils/uuid-v4                               | 1.05 KB   | 208.94 B   | 1.1           | 0.5
	@ember-data/store/-private/system/internal-model-map                               | 983.00 B  | 190.52 B   | 1.0           | 0.5
	@ember-data/store/-private/system/references/record                                | 979.00 B  | 189.75 B   | 1.0           | 0.5
	@ember-data/store/index                                                            | 936.00 B  | 181.41 B   | 0.9           | 0.4
	@ember-data/store/-private/system/references/reference                             | 917.00 B  | 177.73 B   | 0.9           | 0.4
	@ember-data/store/-private/system/model/notify-changes                             | 910.00 B  | 176.37 B   | 0.9           | 0.4
	@ember-data/store/-private/system/record-arrays/adapter-populated-record-array     | 892.00 B  | 172.89 B   | 0.9           | 0.4
	@ember-data/store/-private/system/errors-utils                                     | 764.00 B  | 148.08 B   | 0.7           | 0.4
	@ember-data/store/-private/system/snapshot-record-array                            | 753.00 B  | 145.94 B   | 0.7           | 0.4
	@ember-data/store/-private/system/record-notification-manager                      | 689.00 B  | 133.54 B   | 0.7           | 0.3
	@ember-data/store/-private/system/references                                       | 598.00 B  | 115.90 B   | 0.6           | 0.3
	@ember-data/store/-private/system/promise-proxies                                  | 556.00 B  | 107.76 B   | 0.5           | 0.3
	@ember-data/store/-private/utils/construct-resource                                | 506.00 B  | 98.07 B    | 0.5           | 0.2
	@ember-data/store/-private/system/store/common                                     | 505.00 B  | 97.88 B    | 0.5           | 0.2
	@ember-data/store/-private/system/coerce-id                                        | 496.00 B  | 96.13 B    | 0.5           | 0.2
	@ember-data/store/-private/system/record-arrays                                    | 487.00 B  | 94.39 B    | 0.5           | 0.2
	@ember-data/store/-private/system/identity-map                                     | 450.00 B  | 87.22 B    | 0.4           | 0.2
	@ember-data/store/-private/system/diff-array                                       | 438.00 B  | 84.89 B    | 0.4           | 0.2
	@ember-data/store/-private/ts-interfaces/identifier                                | 400.00 B  | 77.52 B    | 0.4           | 0.2
	@ember-data/store/-private/utils/symbol                                            | 393.00 B  | 76.17 B    | 0.4           | 0.2
	@ember-data/store/-private/system/record-data-for                                  | 373.00 B  | 72.29 B    | 0.4           | 0.2
	@ember-data/store/-private/identifiers/is-stable-identifier                        | 327.00 B  | 63.38 B    | 0.3           | 0.2
	@ember-data/store/-private/ts-interfaces/fetch-manager                             | 316.00 B  | 61.24 B    | 0.3           | 0.1
	@ember-data/store/-private/utils/promise-record                                    | 290.00 B  | 56.20 B    | 0.3           | 0.1
	@ember-data/store/-private/system/backburner                                       | 239.00 B  | 46.32 B    | 0.2           | 0.1
	@ember-data/store/-private/system/normalize-model-name                             | 220.00 B  | 42.64 B    | 0.2           | 0.1
	@ember-data/store/-private/utils/is-non-empty-string                               | 212.00 B  | 41.09 B    | 0.2           | 0.1
	@ember-data/store/-debug/index                                                     | 193.00 B  | 37.40 B    | 0.2           | 0.1
	@ember-data/store/-private/system/deprecated-evented                               | 190.00 B  | 36.82 B    | 0.2           | 0.1
	@ember-data/store/-private/ts-interfaces/minimum-serializer-interface              | 98.00 B   | 18.99 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data-record-wrapper                | 96.00 B   | 18.60 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/minimum-adapter-interface                 | 95.00 B   | 18.41 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data-store-wrapper                 | 95.00 B   | 18.41 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/schema-definition-service                 | 95.00 B   | 18.41 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data-json-api                      | 90.00 B   | 17.44 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/ember-data-json-api                       | 89.00 B   | 17.25 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data-schemas                       | 89.00 B   | 17.25 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/promise-proxies                           | 85.00 B   | 16.47 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-instance                           | 85.00 B   | 16.47 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data                               | 81.00 B   | 15.69 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/ds-model                                  | 78.00 B   | 15.11 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/utils                                     | 75.00 B   | 14.53 B    | 0.1           | 0.0

Package: @ember-data/record-data
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '29.76 KB' │
│  compressed  │ '5.77 KB'  │
│ % Of Library │   '14.2'   │
└──────────────┴────────────┘
	Module                                                                            | Bytes     | Compressed | % of Package  | % Of Library
	-------------------------------------------------------------------------------------------------------------------------------------
	@ember-data/record-data/-private/record-data                                      | 7.87 KB   | 1.53 KB    | 26.5          | 3.8
	@ember-data/record-data/-private/graph/index                                      | 4.61 KB   | 915.04 B   | 15.5          | 2.2
	@ember-data/record-data/-private/graph/operations/replace-related-records         | 2.87 KB   | 568.87 B   | 9.6           | 1.4
	@ember-data/record-data/-private/graph/-edge-definition                           | 2.81 KB   | 557.43 B   | 9.4           | 1.3
	@ember-data/record-data/-private/relationships/state/has-many                     | 2.19 KB   | 435.32 B   | 7.4           | 1.0
	@ember-data/record-data/-private/relationships/state/belongs-to                   | 1.90 KB   | 377.37 B   | 6.4           | 0.9
	@ember-data/record-data/-private/graph/operations/update-relationship             | 1.42 KB   | 281.04 B   | 4.8           | 0.7
	@ember-data/record-data/-private/graph/-utils                                     | 1.02 KB   | 202.35 B   | 3.4           | 0.5
	@ember-data/record-data/-private/graph/operations/replace-related-record          | 979.00 B  | 189.75 B   | 3.2           | 0.5
	@ember-data/record-data/-private/index                                            | 977.00 B  | 189.36 B   | 3.2           | 0.5
	@ember-data/record-data/-private/graph/operations/add-to-related-records          | 771.00 B  | 149.43 B   | 2.5           | 0.4
	@ember-data/record-data/-private/relationships/state/implicit                     | 692.00 B  | 134.12 B   | 2.3           | 0.3
	@ember-data/record-data/-private/graph/operations/remove-from-related-records     | 650.00 B  | 125.98 B   | 2.1           | 0.3
	@ember-data/record-data/-private/coerce-id                                        | 406.00 B  | 78.69 B    | 1.3           | 0.2
	@ember-data/record-data/-private/graph/-state                                     | 293.00 B  | 56.79 B    | 1.0           | 0.1
	@ember-data/record-data/-private/normalize-link                                   | 249.00 B  | 48.26 B    | 0.8           | 0.1
	@ember-data/record-data/-private/ts-interfaces/relationship-record-data           | 100.00 B  | 19.38 B    | 0.3           | 0.0
	@ember-data/record-data/-private/graph/-operations                                | 79.00 B   | 15.31 B    | 0.3           | 0.0

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '21.76 KB' │
│  compressed  │ '4.22 KB'  │
│ % Of Library │   '10.4'   │
└──────────────┴────────────┘
	Module                                                     | Bytes     | Compressed | % of Package  | % Of Library
	--------------------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                                | 7.12 KB   | 1.38 KB    | 32.7          | 3.4
	@ember-data/serializer/-private/embedded-records-mixin     | 4.30 KB   | 853.21 B   | 19.8          | 2.1
	@ember-data/serializer/json-api                            | 3.72 KB   | 737.69 B   | 17.1          | 1.8
	@ember-data/serializer/rest                                | 2.71 KB   | 538.44 B   | 12.5          | 1.3
	@ember-data/serializer/-private/index                      | 1.18 KB   | 234.52 B   | 5.4           | 0.6
	@ember-data/serializer/-private/transforms/date            | 523.00 B  | 101.36 B   | 2.3           | 0.2
	@ember-data/serializer/-private/transforms/boolean         | 490.00 B  | 94.97 B    | 2.2           | 0.2
	@ember-data/serializer/-private/transforms/number          | 446.00 B  | 86.44 B    | 2.0           | 0.2
	@ember-data/serializer/-private/transforms/string          | 351.00 B  | 68.03 B    | 1.6           | 0.2
	@ember-data/serializer/-private/utils                      | 286.00 B  | 55.43 B    | 1.3           | 0.1
	@ember-data/serializer/index                               | 243.00 B  | 47.09 B    | 1.1           | 0.1
	@ember-data/serializer/-private/transforms/transform       | 242.00 B  | 46.90 B    | 1.1           | 0.1
	@ember-data/serializer/transform                           | 215.00 B  | 41.67 B    | 1.0           | 0.1

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '20.80 KB' │
│  compressed  │ '4.03 KB'  │
│ % Of Library │   '9.9'    │
└──────────────┴────────────┘
	Module                                                                | Bytes     | Compressed | % of Package  | % Of Library
	-------------------------------------------------------------------------------------------------------------------------
	@ember-data/model/-private/model                                      | 9.60 KB   | 1.86 KB    | 46.2          | 4.6
	@ember-data/model/-private/system/many-array                          | 2.45 KB   | 485.72 B   | 11.8          | 1.2
	@ember-data/model/-private/errors                                     | 2.03 KB   | 403.54 B   | 9.8           | 1.0
	@ember-data/model/-private/index                                      | 1.29 KB   | 256.04 B   | 6.2           | 0.6
	@ember-data/model/-private/system/relationships/relationship-meta     | 1.25 KB   | 248.67 B   | 6.0           | 0.6
	@ember-data/model/-private/attr                                       | 673.00 B  | 130.44 B   | 3.2           | 0.3
	@ember-data/model/-private/system/promise-many-array                  | 642.00 B  | 124.43 B   | 3.0           | 0.3
	@ember-data/model/-private/belongs-to                                 | 626.00 B  | 121.33 B   | 2.9           | 0.3
	@ember-data/model/-private/has-many                                   | 587.00 B  | 113.77 B   | 2.8           | 0.3
	@ember-data/model/index                                               | 486.00 B  | 94.19 B    | 2.3           | 0.2
	@ember-data/model/-private/util                                       | 442.00 B  | 85.66 B    | 2.1           | 0.2
	@ember-data/model/-private/system/promise-belongs-to                  | 412.00 B  | 79.85 B    | 1.9           | 0.2
	@ember-data/model/-private/system/model-for-mixin                     | 408.00 B  | 79.07 B    | 1.9           | 0.2

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '18.14 KB' │
│  compressed  │ '3.52 KB'  │
│ % Of Library │   '8.7'    │
└──────────────┴────────────┘
	Module                                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                                      | 8.37 KB   | 1.62 KB    | 46.1          | 4.0
	@ember-data/adapter/error                                     | 1.91 KB   | 379.70 B   | 10.5          | 0.9
	@ember-data/adapter/-private/build-url-mixin                  | 1.82 KB   | 361.86 B   | 10.1          | 0.9
	@ember-data/adapter/index                                     | 1.14 KB   | 225.61 B   | 6.3           | 0.5
	@ember-data/adapter/-private/index                            | 1.03 KB   | 204.67 B   | 5.7           | 0.5
	@ember-data/adapter/json-api                                  | 1.02 KB   | 202.15 B   | 5.6           | 0.5
	@ember-data/adapter/-private/utils/serialize-query-params     | 792.00 B  | 153.50 B   | 4.3           | 0.4
	@ember-data/adapter/-private/utils/determine-body-promise     | 549.00 B  | 106.40 B   | 3.0           | 0.3
	@ember-data/adapter/-private/utils/parse-response-headers     | 480.00 B  | 93.03 B    | 2.6           | 0.2
	@ember-data/adapter/-private/utils/fetch                      | 454.00 B  | 87.99 B    | 2.4           | 0.2
	@ember-data/adapter/-private/utils/serialize-into-hash        | 347.00 B  | 67.25 B    | 1.9           | 0.2
	@ember-data/adapter/-private/utils/continue-on-reject         | 219.00 B  | 42.44 B    | 1.2           | 0.1
	@ember-data/adapter/-private/fastboot-interface               | 76.00 B   | 14.73 B    | 0.4           | 0.0

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '9.50 KB' │
│  compressed  │ '1.84 KB' │
│ % Of Library │   '4.5'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.32 KB   | 461.10 B   | 24.5          | 1.1
	ember-data/-private/index                         | 1.93 KB   | 382.60 B   | 20.3          | 0.9
	ember-data/adapters/errors                        | 1.19 KB   | 235.88 B   | 12.5          | 0.6
	ember-data/setup-container                        | 503.00 B  | 97.49 B    | 5.2           | 0.2
	ember-data/-private/core                          | 321.00 B  | 62.21 B    | 3.3           | 0.1
	ember-data/relationships                          | 318.00 B  | 61.63 B    | 3.3           | 0.1
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 53.10 B    | 2.8           | 0.1
	ember-data/serializers/json-api                   | 251.00 B  | 48.64 B    | 2.6           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 47.48 B    | 2.5           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 47.09 B    | 2.5           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 47.09 B    | 2.5           | 0.1
	ember-data/transform                              | 241.00 B  | 46.71 B    | 2.5           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 45.93 B    | 2.4           | 0.1
	ember-data/serializer                             | 232.00 B  | 44.96 B    | 2.4           | 0.1
	ember-data/adapter                                | 226.00 B  | 43.80 B    | 2.3           | 0.1
	ember-data/model                                  | 222.00 B  | 43.02 B    | 2.3           | 0.1
	ember-data/store                                  | 222.00 B  | 43.02 B    | 2.3           | 0.1
	ember-data/attr                                   | 218.00 B  | 42.25 B    | 2.2           | 0.1
	ember-data/version                                | 162.00 B  | 31.39 B    | 1.7           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '6.66 KB' │
│  compressed  │ '1.29 KB' │
│ % Of Library │   '3.2'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 2.88 KB   | 571.58 B   | 43.3          | 1.4
	ember-inflector/lib/system/inflections            | 1.59 KB   | 315.34 B   | 23.9          | 0.8
	ember-inflector/index                             | 473.00 B  | 91.67 B    | 6.9           | 0.2
	ember-inflector/lib/system                        | 471.00 B  | 91.29 B    | 6.9           | 0.2
	ember-inflector/lib/helpers/pluralize             | 373.00 B  | 72.29 B    | 5.5           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 61.63 B    | 4.7           | 0.1
	ember-inflector/lib/utils/make-helper             | 308.00 B  | 59.69 B    | 4.5           | 0.1
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 57.37 B    | 4.3           | 0.1

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.70 KB'  │
│  compressed  │ '535.92 B' │
│ % Of Library │   '1.3'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                           | 2.21 KB   | 439.20 B   | 82.0          | 1.1
	@ember-data/debug/setup                           | 499.00 B  | 96.71 B    | 18.0          | 0.2

@github-actions
Copy link

github-actions bot commented Apr 30, 2021

Performance Report for a34fcdf

Scenario - materialization: ✅ Performance improved

✅ duration
phase estimated improvement -622ms [-668ms to -576ms] OR -16.25% [-17.44% to -15.06%]
☑️ Phase [navigationStart] => [start-find-all]
phase no difference [-14ms to 23ms]
✅ Phase [start-find-all] => [start-materialization]
phase estimated improvement -583ms [-611ms to -554ms] OR -28.1% [-29.42% to -26.67%]
☑️ Phase [start-materialization] => [end-materialization]
phase no difference [-15ms to 24ms]
✅ Phase [end-materialization] => [Test End]
phase estimated improvement -37ms [-49ms to -29ms] OR -30.7% [-40.05% to -23.91%]

Scenario - unload: ✅ Performance improved

✅ duration
phase estimated improvement -284ms [-339ms to -227ms] OR -3.83% [-4.57% to -3.06%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-12ms to 21ms]
✅ Phase [start-push-payload] => [start-unload-records]
phase estimated improvement -151ms [-190ms to -114ms] OR -5.91% [-7.43% to -4.46%]
✅ Phase [start-unload-records] => [end-unload-records]
phase estimated improvement -131ms [-155ms to -106ms] OR -3.4% [-4.01% to -2.75%]
✅ Phase [end-unload-records] => [Test End]
phase estimated improvement -2ms [-4ms to 0ms] OR -2.33% [-4.57% to -0.15%]

Scenario - destroy: ✅ Performance improved

✅ duration
phase estimated improvement -270ms [-383ms to -180ms] OR -5.4% [-7.67% to -3.59%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-35ms to 23ms]
✅ Phase [start-push-payload] => [start-destroy-records]
phase estimated improvement -163ms [-228ms to -102ms] OR -5.81% [-8.12% to -3.64%]
✅ Phase [start-destroy-records] => [end-destroy-records]
phase estimated improvement -107ms [-139ms to -76ms] OR -9.61% [-12.53% to -6.87%]
☑️ Phase [end-destroy-records] => [Test End]
phase no difference [-8ms to 3ms]

Scenario - add-children: ✅ Performance improved

✅ duration
phase estimated improvement -130ms [-164ms to -98ms] OR -4.44% [-5.6% to -3.34%]
☑️ Phase [navigationStart] => [start-push-initial-payload]
phase no difference [-30ms to 6ms]
☑️ Phase [start-push-initial-payload] => [start-push-update-payload]
phase no difference [-12ms to 28ms]
✅ Phase [start-push-update-payload] => [end-push-update-payload]
phase estimated improvement -147ms [-159ms to -135ms] OR -30% [-32.38% to -27.61%]
⚠️ Phase [end-push-update-payload] => [Test End]
phase estimated regression +13ms [7ms to 19ms] OR +6.81% [3.53% to 10.26%]

Scenario - unused-relationships: ✅ Performance improved

✅ duration
phase estimated improvement -171ms [-236ms to -108ms] OR -4.4% [-6.07% to -2.79%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-23ms to 15ms]
✅ Phase [start-push-payload] => [end-push-payload]
phase estimated improvement -170ms [-222ms to -121ms] OR -6.25% [-8.14% to -4.43%]
☑️ Phase [end-push-payload] => [Test End]
phase no difference [-4ms to 11ms]

@runspired runspired force-pushed the runspired/even-simpler-relationships branch from 7bd2e41 to caffec6 Compare April 30, 2021 22:52
@runspired runspired changed the title [WIP] The graph should coordinate state updates [WIP] Relationship Refactor (part 2): The graph should coordinate state updates Apr 30, 2021
@runspired runspired changed the base branch from master to runspired/simpler-relationships April 30, 2021 22:53
@delete-merged-branch delete-merged-branch bot deleted the branch master May 1, 2021 02:50
@runspired runspired force-pushed the runspired/even-simpler-relationships branch from 0683d69 to 72e8068 Compare May 1, 2021 06:18
@runspired runspired changed the base branch from runspired/simpler-relationships to master May 1, 2021 06:19
@runspired runspired requested a review from snewcomer May 3, 2021 22:17
@runspired runspired changed the title [WIP] Relationship Refactor (part 2): The graph should coordinate state updates Relationship Refactor (part 2): The graph should coordinate state updates May 3, 2021
@runspired runspired added the 🏷️ chore This PR primarily refactors code or updates dependencies label May 3, 2021
@runspired runspired force-pushed the runspired/even-simpler-relationships branch from 84a8e30 to fb7f032 Compare May 4, 2021 04:11
Copy link
Contributor

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice and easy to follow. When I get to work in this area, I am sure it will all be easy to navigate and understand. Not able to comment on edge cases or potential regressions other than relying on the test suite. So you get an A+ from me!

this._internalModel.rollbackAttributes();
this.store._backburner.join(() => {
this._internalModel.rollbackAttributes();
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did you see here (and in other spots) to add the join?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed we were using a join around the notify and push schedules, which meant these things were being called without an existing join. I worked through all the possible entry points to that flush and found which ones didn't have a join wrapper already and added them.

Moving the join up means that a lot of scenarios that were creating a flush-per-schedule now create only one flush, which helps us avoid a lot more work. This had the most noticeable effect on teardown/unload.

syncRelationships is used by the UI to grab updates from the graph
and update the ManyArrays.

We may be able to remove this once the new relationship layer is
complete.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the other question, what will allow it's removal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our scheduler right now does three things (which is why there are three queues)

  • it batches payloads that have been pushed for a single flush, thereby allowing us to order the pushes by type (more efficient to push hasMany first. Removing this batching regressed the update scenario by 500%). It's unclear how we'd do this without some form of run loop concept, however we could probably make a simpler queue thing and drop our need for backburner if this was all that was left.
  • it batches (and minimizes) updates to hasMany local state in a second pass, this allows us to update the local state with those changes only once instead of potentially many times. This optimization would go away if we were to compute localState lazily on access.
  • it notifies the UI layer only once all state has settled (and minimizes those notifications to only one per relationship). We can possibly do away with this once we no longer support sync-observers if state is also lazily calculated.

assert.equal(comment.get('post'), post);
assert.equal(post.get('bestComment'), comment);
assert.strictEqual(post2.get('bestComment'), null);
assert.ok(comment.get('post') === post, 'comment post is set correctly');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some cleanup here

@@ -1046,11 +1046,7 @@ module('integration/store - deleteRecord', function (hooks) {

assert.ok(store.hasRecordForId('person', '1'), 'expected the record to be in the store');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an intentional removal

@runspired runspired added 🏷️ perf PRs that improve performance in a notable way and removed 🏷️ chore This PR primarily refactors code or updates dependencies performance labels May 27, 2021
@runspired runspired added this to the Public Graph API milestone Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ perf PRs that improve performance in a notable way
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants