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

refactor: Native Model #7226

Merged
merged 13 commits into from
Apr 21, 2021
Merged

refactor: Native Model #7226

merged 13 commits into from
Apr 21, 2021

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Jun 13, 2020

Now that our minimum Ember LTS is 3.12 (and for current canary 3.16! although we didn't go that far here) 🎉 3.20 🎉we can refactor Model to be a native class. (support for this began in 3.6 and decorator support began in 3.10)

Note: in 3.16 minimum support we can embrace a @Tracked world, we should prepare :) (this also helps us prepare)

This PR does that refactor as minimally as possible. The few test changes were minor cleanups I did while investigating failures (not fixes, just made debugging easier) that seemed worthwhile to just keep.

@runspired runspired added the 🏷️ chore This PR primarily refactors code or updates dependencies label Jun 13, 2020
@runspired runspired requested a review from igorT June 13, 2020 01:57
@runspired
Copy link
Contributor Author

cc @snewcomer if we can land this then we can probably do some nice things to make sure that folks calling destroyRecord today don't get surprised by isDeleted suddenly returning false when #7217 lands

@github-actions
Copy link

github-actions bot commented Jun 13, 2020

Asset Size Report for 7c95440

IE11 Builds

🛑 The size of the library EmberData has increased by +3.34 KB (+354.0 B compressed) which exceeds the failure threshold of 75 bytes.

Warnings

⚠️ The uncompressed size of the package @ember-data/store has increased by +1.02 KB.
⚠️ The uncompressed size of the package @ember-data/model has increased by +2.33 KB.

Changeset


EmberData +180.5 KB +3.34 KB (+36.61 KB +354.0 B compressed)
    @ember-data/store +77.63 KB +1.02 KB (+15.74 KB +107.83 B compressed)
        @ember-data/store/-private +76.71 KB +1.02 KB (+15.56 KB +107.83 B compressed)
    @ember-data/model +18.12 KB +2.33 KB (+3.68 KB +246.17 B compressed)
        @ember-data/model/-private +17.65 KB +2.33 KB (+3.58 KB +246.17 B compressed)

Full Asset Analysis (IE11)

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


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

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '77.63 KB' │
│  compressed  │ '15.74 KB' │
│ % Of Library │   '43.0'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 76.71 KB  | 15.56 KB   | 98.8          | 42.5
	@ember-data/store/index                           | 936.00 B  | 189.84 B   | 1.2           | 0.5

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

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '20.84 KB' │
│  compressed  │ '4.23 KB'  │
│ % Of Library │   '11.5'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                       | 7.75 KB   | 1.57 KB    | 37.2          | 4.3
	@ember-data/serializer/-private                   | 5.69 KB   | 1.15 KB    | 27.3          | 3.2
	@ember-data/serializer/json-api                   | 3.95 KB   | 820.01 B   | 18.9          | 2.2
	@ember-data/serializer/rest                       | 3.00 KB   | 622.26 B   | 14.4          | 1.7
	@ember-data/serializer/index                      | 258.00 B  | 52.32 B    | 1.2           | 0.1
	@ember-data/serializer/transform                  | 215.00 B  | 43.60 B    | 1.0           | 0.1

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '18.47 KB' │
│  compressed  │ '3.75 KB'  │
│ % Of Library │   '10.2'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                          | 9.31 KB   | 1.89 KB    | 50.4          | 5.2
	@ember-data/adapter/-private                      | 3.80 KB   | 790.20 B   | 20.6          | 2.1
	@ember-data/adapter/error                         | 1.95 KB   | 404.43 B   | 10.5          | 1.1
	@ember-data/adapter/index                         | 1.81 KB   | 375.22 B   | 9.8           | 1.0
	@ember-data/adapter/json-api                      | 1.60 KB   | 333.03 B   | 8.7           | 0.9

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '18.12 KB' │
│  compressed  │ '3.68 KB'  │
│ % Of Library │   '10.0'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 17.65 KB  | 3.58 KB    | 97.4          | 9.8
	@ember-data/model/index                           | 486.00 B  | 98.57 B    | 2.6           | 0.3

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '9.24 KB' │
│  compressed  │ '1.87 KB' │
│ % Of Library │   '5.1'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.32 KB   | 482.51 B   | 25.1          | 1.3
	ember-data/-private                               | 1.98 KB   | 411.52 B   | 21.4          | 1.1
	ember-data/adapters/errors                        | 1.19 KB   | 246.83 B   | 12.9          | 0.7
	ember-data/setup-container                        | 503.00 B  | 102.02 B   | 5.3           | 0.3
	ember-data/relationships                          | 318.00 B  | 64.49 B    | 3.4           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 55.57 B    | 2.9           | 0.1
	ember-data/serializers/json-api                   | 251.00 B  | 50.90 B    | 2.7           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 49.69 B    | 2.6           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 49.28 B    | 2.6           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 49.28 B    | 2.6           | 0.1
	ember-data/transform                              | 241.00 B  | 48.88 B    | 2.5           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 48.06 B    | 2.5           | 0.1
	ember-data/serializer                             | 232.00 B  | 47.05 B    | 2.5           | 0.1
	ember-data/adapter                                | 226.00 B  | 45.83 B    | 2.4           | 0.1
	ember-data/model                                  | 222.00 B  | 45.02 B    | 2.3           | 0.1
	ember-data/store                                  | 222.00 B  | 45.02 B    | 2.3           | 0.1
	ember-data/attr                                   | 218.00 B  | 44.21 B    | 2.3           | 0.1
	ember-data/version                                | 162.00 B  | 32.85 B    | 1.7           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '8.15 KB' │
│  compressed  │ '1.65 KB' │
│ % Of Library │   '4.5'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 3.11 KB   | 645.78 B   | 38.1          | 1.7
	ember-inflector/lib/helpers/pluralize             | 1.62 KB   | 336.28 B   | 19.9          | 0.9
	ember-inflector/lib/system/inflections            | 1.59 KB   | 329.99 B   | 19.5          | 0.9
	ember-inflector/index                             | 473.00 B  | 95.93 B    | 5.7           | 0.3
	ember-inflector/lib/system                        | 471.00 B  | 95.52 B    | 5.6           | 0.3
	ember-inflector/lib/system/string                 | 332.00 B  | 67.33 B    | 4.0           | 0.2
	ember-inflector/lib/utils/make-helper             | 308.00 B  | 62.46 B    | 3.7           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 60.03 B    | 3.5           | 0.2

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

Modern Builds

🛑 The size of the library EmberData has increased by +2.41 KB (+401.0 B compressed) which exceeds the failure threshold of 75 bytes.

Warnings

⚠️ The uncompressed size of the package @ember-data/store has increased by +1.01 KB.
⚠️ The uncompressed size of the package @ember-data/model has increased by +1.4 KB.

Changeset


EmberData +160.29 KB +2.41 KB (+34.56 KB +401.0 B compressed)
    @ember-data/store +68.51 KB +1.01 KB (+14.77 KB +167.88 B compressed)
        @ember-data/store/-private +67.6 KB +1.01 KB (+14.57 KB +167.88 B compressed)
    @ember-data/model +15.8 KB +1.4 KB (+3.41 KB +233.12 B compressed)
        @ember-data/model/-private +15.32 KB +1.4 KB (+3.3 KB +233.12 B compressed)

Full Asset Analysis (Modern)

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


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

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '68.51 KB' │
│  compressed  │ '14.77 KB' │
│ % Of Library │   '42.7'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 67.60 KB  | 14.57 KB   | 98.7          | 42.2
	@ember-data/store/index                           | 936.00 B  | 201.78 B   | 1.3           | 0.6

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

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '19.37 KB' │
│  compressed  │ '4.18 KB'  │
│ % Of Library │   '12.1'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                       | 7.12 KB   | 1.53 KB    | 36.8          | 4.4
	@ember-data/serializer/-private                   | 5.37 KB   | 1.16 KB    | 27.7          | 3.4
	@ember-data/serializer/json-api                   | 3.72 KB   | 820.51 B   | 19.2          | 2.3
	@ember-data/serializer/rest                       | 2.71 KB   | 598.89 B   | 14.0          | 1.7
	@ember-data/serializer/index                      | 243.00 B  | 52.38 B    | 1.2           | 0.1
	@ember-data/serializer/transform                  | 215.00 B  | 46.35 B    | 1.1           | 0.1

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '16.02 KB' │
│  compressed  │ '3.45 KB'  │
│ % Of Library │   '10.0'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                          | 8.37 KB   | 1.80 KB    | 52.2          | 5.2
	@ember-data/adapter/-private                      | 3.58 KB   | 791.19 B   | 22.4          | 2.2
	@ember-data/adapter/error                         | 1.91 KB   | 422.33 B   | 11.9          | 1.2
	@ember-data/adapter/index                         | 1.14 KB   | 250.94 B   | 7.1           | 0.7
	@ember-data/adapter/json-api                      | 1.02 KB   | 224.85 B   | 6.4           | 0.6

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '15.80 KB' │
│  compressed  │ '3.41 KB'  │
│ % Of Library │   '9.9'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 15.32 KB  | 3.30 KB    | 97.0          | 9.6
	@ember-data/model/index                           | 486.00 B  | 104.77 B   | 3.0           | 0.3

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '9.24 KB' │
│  compressed  │ '1.99 KB' │
│ % Of Library │   '5.8'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.32 KB   | 512.87 B   | 25.1          | 1.4
	ember-data/-private                               | 1.98 KB   | 437.42 B   | 21.4          | 1.2
	ember-data/adapters/errors                        | 1.19 KB   | 262.36 B   | 12.9          | 0.7
	ember-data/setup-container                        | 503.00 B  | 108.43 B   | 5.3           | 0.3
	ember-data/relationships                          | 318.00 B  | 68.55 B    | 3.4           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 59.07 B    | 2.9           | 0.2
	ember-data/serializers/json-api                   | 251.00 B  | 54.11 B    | 2.7           | 0.2
	ember-data/adapters/json-api                      | 245.00 B  | 52.81 B    | 2.6           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 52.38 B    | 2.6           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 52.38 B    | 2.6           | 0.1
	ember-data/transform                              | 241.00 B  | 51.95 B    | 2.5           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 51.09 B    | 2.5           | 0.1
	ember-data/serializer                             | 232.00 B  | 50.01 B    | 2.5           | 0.1
	ember-data/adapter                                | 226.00 B  | 48.72 B    | 2.4           | 0.1
	ember-data/model                                  | 222.00 B  | 47.85 B    | 2.3           | 0.1
	ember-data/store                                  | 222.00 B  | 47.85 B    | 2.3           | 0.1
	ember-data/attr                                   | 218.00 B  | 46.99 B    | 2.3           | 0.1
	ember-data/version                                | 162.00 B  | 34.92 B    | 1.7           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '6.66 KB' │
│  compressed  │ '1.43 KB' │
│ % Of Library │   '4.2'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 2.88 KB   | 635.75 B   | 43.3          | 1.8
	ember-inflector/lib/system/inflections            | 1.59 KB   | 350.75 B   | 23.9          | 1.0
	ember-inflector/index                             | 473.00 B  | 101.97 B   | 6.9           | 0.3
	ember-inflector/lib/system                        | 471.00 B  | 101.53 B   | 6.9           | 0.3
	ember-inflector/lib/helpers/pluralize             | 373.00 B  | 80.41 B    | 5.5           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 68.55 B    | 4.7           | 0.2
	ember-inflector/lib/utils/make-helper             | 308.00 B  | 66.39 B    | 4.5           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 63.81 B    | 4.3           | 0.2

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

Modern Builds (No Rollup)

🛑 The size of the library EmberData has increased by +1.75 KB (+214.0 B compressed) which exceeds the failure threshold of 75 bytes.

Warnings

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

Changeset


EmberData +203.7 KB +1.75 KB (+38.82 KB +214.0 B compressed)
    @ember-data/store +99.83 KB +1014.0 B (+19.03 KB +121.43 B compressed)
        @ember-data/store/-private/system/model/internal-model +16.32 KB +1011.0 B (+3.11 KB +121.07 B compressed)
        @ember-data/store/-private/system/store/internal-model-factory +2.91 KB +3.0 B (+568.7 B +0.36 B compressed)
    @ember-data/model +19.48 KB +773.0 B (+3.71 KB +92.57 B compressed)
        @ember-data/model/-private/model +8.38 KB +2.18 KB (+1.6 KB +267.41 B compressed)
        @ember-data/model/-private/system/relationships/relationship-meta +1.25 KB -50.0 B (+244.52 B -5.99 B compressed)
        @ember-data/model/-private/system/relationships/ext 0.0 B -1.23 KB (0.0 B -150.89 B compressed)
        @ember-data/model/-private/belongs-to +589.0 B -74.0 B (+112.25 B -8.86 B compressed)
        @ember-data/model/-private/has-many +550.0 B -76.0 B (+104.82 B -9.1 B compressed)

Full Asset Analysis (Modern)

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


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

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '99.83 KB' │
│  compressed  │ '19.03 KB' │
│ % Of Library │   '49.0'   │
└──────────────┴────────────┘
	Module                                                                             | Bytes     | Compressed | % of Package  | % Of Library
	--------------------------------------------------------------------------------------------------------------------------------------
	@ember-data/store/-private/system/core-store                                       | 17.12 KB  | 3.26 KB    | 17.2          | 8.4
	@ember-data/store/-private/system/model/internal-model                             | 16.32 KB  | 3.11 KB    | 16.3          | 8.0
	@ember-data/store/-private/system/model/states                                     | 5.47 KB   | 1.04 KB    | 5.5           | 2.7
	@ember-data/store/-private/system/fetch-manager                                    | 4.96 KB   | 968.36 B   | 5.0           | 2.4
	@ember-data/store/-private/system/record-array-manager                             | 4.47 KB   | 871.54 B   | 4.5           | 2.2
	@ember-data/store/-private/system/store/finders                                    | 4.37 KB   | 852.86 B   | 4.4           | 2.1
	@ember-data/store/-private/index                                                   | 4.16 KB   | 811.89 B   | 4.2           | 2.0
	@ember-data/store/-private/identifiers/cache                                       | 3.86 KB   | 753.57 B   | 3.9           | 1.9
	@ember-data/store/-private/system/store/record-data-store-wrapper                  | 3.37 KB   | 657.51 B   | 3.4           | 1.7
	@ember-data/store/-private/system/store/internal-model-factory                     | 2.91 KB   | 568.70 B   | 2.9           | 1.4
	@ember-data/store/-private/system/snapshot                                         | 2.85 KB   | 556.31 B   | 2.9           | 1.4
	@ember-data/store/-private/system/record-arrays/record-array                       | 2.25 KB   | 438.91 B   | 2.3           | 1.1
	@ember-data/store/-private/system/ds-model-store                                   | 1.99 KB   | 388.41 B   | 2.0           | 1.0
	@ember-data/store/-private/system/request-cache                                    | 1.89 KB   | 368.02 B   | 1.9           | 0.9
	@ember-data/store/-private/system/references/has-many                              | 1.52 KB   | 295.97 B   | 1.5           | 0.7
	@ember-data/store/-private/system/schema-definition-service                        | 1.47 KB   | 287.59 B   | 1.5           | 0.7
	@ember-data/store/-private/system/model/shim-model-class                           | 1.27 KB   | 247.76 B   | 1.3           | 0.6
	@ember-data/store/-private/system/references/belongs-to                            | 1.25 KB   | 243.37 B   | 1.2           | 0.6
	@ember-data/store/-private/system/store/serializer-response                        | 1.12 KB   | 219.36 B   | 1.1           | 0.6
	@ember-data/store/-private/identifiers/utils/uuid-v4                               | 1.05 KB   | 205.45 B   | 1.1           | 0.5
	@ember-data/store/-private/system/internal-model-map                               | 983.00 B  | 187.34 B   | 1.0           | 0.5
	@ember-data/store/-private/system/references/record                                | 979.00 B  | 186.58 B   | 1.0           | 0.5
	@ember-data/store/index                                                            | 936.00 B  | 178.38 B   | 0.9           | 0.4
	@ember-data/store/-private/system/references/reference                             | 917.00 B  | 174.76 B   | 0.9           | 0.4
	@ember-data/store/-private/system/record-arrays/adapter-populated-record-array     | 892.00 B  | 170.00 B   | 0.9           | 0.4
	@ember-data/store/-private/system/model/notify-changes                             | 866.00 B  | 165.04 B   | 0.8           | 0.4
	@ember-data/store/-private/system/errors-utils                                     | 764.00 B  | 145.60 B   | 0.7           | 0.4
	@ember-data/store/-private/system/snapshot-record-array                            | 753.00 B  | 143.51 B   | 0.7           | 0.4
	@ember-data/store/-private/system/record-notification-manager                      | 689.00 B  | 131.31 B   | 0.7           | 0.3
	@ember-data/store/-private/system/references                                       | 598.00 B  | 113.97 B   | 0.6           | 0.3
	@ember-data/store/-private/system/promise-proxies                                  | 556.00 B  | 105.96 B   | 0.5           | 0.3
	@ember-data/store/-private/utils/construct-resource                                | 506.00 B  | 96.43 B    | 0.5           | 0.2
	@ember-data/store/-private/system/store/common                                     | 505.00 B  | 96.24 B    | 0.5           | 0.2
	@ember-data/store/-private/system/coerce-id                                        | 496.00 B  | 94.53 B    | 0.5           | 0.2
	@ember-data/store/-private/system/record-arrays                                    | 487.00 B  | 92.81 B    | 0.5           | 0.2
	@ember-data/store/-private/system/identity-map                                     | 450.00 B  | 85.76 B    | 0.4           | 0.2
	@ember-data/store/-private/system/diff-array                                       | 438.00 B  | 83.47 B    | 0.4           | 0.2
	@ember-data/store/-private/ts-interfaces/identifier                                | 400.00 B  | 76.23 B    | 0.4           | 0.2
	@ember-data/store/-private/utils/symbol                                            | 393.00 B  | 74.90 B    | 0.4           | 0.2
	@ember-data/store/-private/identifiers/is-stable-identifier                        | 327.00 B  | 62.32 B    | 0.3           | 0.2
	@ember-data/store/-private/ts-interfaces/fetch-manager                             | 316.00 B  | 60.22 B    | 0.3           | 0.2
	@ember-data/store/-private/utils/promise-record                                    | 290.00 B  | 55.26 B    | 0.3           | 0.1
	@ember-data/store/-private/system/backburner                                       | 268.00 B  | 51.07 B    | 0.3           | 0.1
	@ember-data/store/-private/utils/brand                                             | 258.00 B  | 49.17 B    | 0.3           | 0.1
	@ember-data/store/-private/system/record-data-for                                  | 235.00 B  | 44.78 B    | 0.2           | 0.1
	@ember-data/store/-private/system/ts-upgrade-map                                   | 234.00 B  | 44.59 B    | 0.2           | 0.1
	@ember-data/store/-private/system/normalize-model-name                             | 220.00 B  | 41.92 B    | 0.2           | 0.1
	@ember-data/store/-private/utils/is-non-empty-string                               | 212.00 B  | 40.40 B    | 0.2           | 0.1
	@ember-data/store/-debug/index                                                     | 193.00 B  | 36.78 B    | 0.2           | 0.1
	@ember-data/store/-private/system/deprecated-evented                               | 190.00 B  | 36.21 B    | 0.2           | 0.1
	@ember-data/store/-private/ts-interfaces/record-data-store-wrapper                 | 136.00 B  | 25.91 B    | 0.1           | 0.1
	@ember-data/store/-private/ts-interfaces/minimum-serializer-interface              | 98.00 B   | 18.67 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data-record-wrapper                | 96.00 B   | 18.29 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/minimum-adapter-interface                 | 95.00 B   | 18.10 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/schema-definition-service                 | 95.00 B   | 18.10 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data-json-api                      | 90.00 B   | 17.15 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/ember-data-json-api                       | 89.00 B   | 16.96 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data-schemas                       | 89.00 B   | 16.96 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/promise-proxies                           | 85.00 B   | 16.19 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-instance                           | 85.00 B   | 16.19 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/record-data                               | 81.00 B   | 15.43 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/ds-model                                  | 78.00 B   | 14.86 B    | 0.1           | 0.0
	@ember-data/store/-private/ts-interfaces/utils                                     | 75.00 B   | 14.29 B    | 0.1           | 0.0

Package: @ember-data/record-data
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '25.64 KB' │
│  compressed  │ '4.89 KB'  │
│ % Of Library │   '12.6'   │
└──────────────┴────────────┘
	Module                                                                      | Bytes     | Compressed | % of Package  | % Of Library
	-------------------------------------------------------------------------------------------------------------------------------
	@ember-data/record-data/-private/relationships/state/relationship           | 7.90 KB   | 1.51 KB    | 30.8          | 3.9
	@ember-data/record-data/-private/record-data                                | 7.76 KB   | 1.48 KB    | 30.3          | 3.8
	@ember-data/record-data/-private/relationships/state/belongs-to             | 2.92 KB   | 570.80 B   | 11.4          | 1.4
	@ember-data/record-data/-private/relationships/state/has-many               | 2.67 KB   | 521.06 B   | 10.4          | 1.3
	@ember-data/record-data/-private/ordered-set                                | 1.14 KB   | 222.98 B   | 4.5           | 0.6
	@ember-data/record-data/-private/relationships/state/create                 | 1.05 KB   | 204.49 B   | 4.1           | 0.5
	@ember-data/record-data/-private/index                                      | 1017.00 B | 193.82 B   | 3.9           | 0.5
	@ember-data/record-data/-private/accessors                                  | 475.00 B  | 90.52 B    | 1.8           | 0.2
	@ember-data/record-data/-private/coerce-id                                  | 406.00 B  | 77.37 B    | 1.5           | 0.2
	@ember-data/record-data/-private/normalize-link                             | 249.00 B  | 47.45 B    | 0.9           | 0.1
	@ember-data/record-data/-private/ts-interfaces/relationship-record-data     | 100.00 B  | 19.05 B    | 0.4           | 0.0

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '21.76 KB' │
│  compressed  │ '4.15 KB'  │
│ % Of Library │   '10.7'   │
└──────────────┴────────────┘
	Module                                                     | Bytes     | Compressed | % of Package  | % Of Library
	--------------------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                                | 7.12 KB   | 1.36 KB    | 32.7          | 3.5
	@ember-data/serializer/-private/embedded-records-mixin     | 4.30 KB   | 838.95 B   | 19.8          | 2.1
	@ember-data/serializer/json-api                            | 3.72 KB   | 725.36 B   | 17.1          | 1.8
	@ember-data/serializer/rest                                | 2.71 KB   | 529.44 B   | 12.5          | 1.3
	@ember-data/serializer/-private/index                      | 1.18 KB   | 230.60 B   | 5.4           | 0.6
	@ember-data/serializer/-private/transforms/date            | 523.00 B  | 99.67 B    | 2.3           | 0.3
	@ember-data/serializer/-private/transforms/boolean         | 490.00 B  | 93.38 B    | 2.2           | 0.2
	@ember-data/serializer/-private/transforms/number          | 446.00 B  | 85.00 B    | 2.0           | 0.2
	@ember-data/serializer/-private/transforms/string          | 351.00 B  | 66.89 B    | 1.6           | 0.2
	@ember-data/serializer/-private/utils                      | 286.00 B  | 54.50 B    | 1.3           | 0.1
	@ember-data/serializer/index                               | 243.00 B  | 46.31 B    | 1.1           | 0.1
	@ember-data/serializer/-private/transforms/transform       | 242.00 B  | 46.12 B    | 1.1           | 0.1
	@ember-data/serializer/transform                           | 215.00 B  | 40.97 B    | 1.0           | 0.1

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '19.48 KB' │
│  compressed  │ '3.71 KB'  │
│ % Of Library │   '9.6'    │
└──────────────┴────────────┘
	Module                                                                | Bytes     | Compressed | % of Package  | % Of Library
	-------------------------------------------------------------------------------------------------------------------------
	@ember-data/model/-private/model                                      | 8.38 KB   | 1.60 KB    | 43.1          | 4.1
	@ember-data/model/-private/system/many-array                          | 2.41 KB   | 470.55 B   | 12.4          | 1.2
	@ember-data/model/-private/errors                                     | 2.03 KB   | 396.79 B   | 10.4          | 1.0
	@ember-data/model/-private/index                                      | 1.29 KB   | 251.76 B   | 6.6           | 0.6
	@ember-data/model/-private/system/relationships/relationship-meta     | 1.25 KB   | 244.52 B   | 6.4           | 0.6
	@ember-data/model/-private/attr                                       | 673.00 B  | 128.26 B   | 3.4           | 0.3
	@ember-data/model/-private/system/promise-many-array                  | 642.00 B  | 122.35 B   | 3.2           | 0.3
	@ember-data/model/-private/belongs-to                                 | 589.00 B  | 112.25 B   | 3.0           | 0.3
	@ember-data/model/-private/has-many                                   | 550.00 B  | 104.82 B   | 2.8           | 0.3
	@ember-data/model/index                                               | 486.00 B  | 92.62 B    | 2.4           | 0.2
	@ember-data/model/-private/util                                       | 442.00 B  | 84.23 B    | 2.2           | 0.2
	@ember-data/model/-private/system/promise-belongs-to                  | 412.00 B  | 78.52 B    | 2.1           | 0.2
	@ember-data/model/-private/system/model-for-mixin                     | 408.00 B  | 77.75 B    | 2.0           | 0.2

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '18.14 KB' │
│  compressed  │ '3.46 KB'  │
│ % Of Library │   '8.9'    │
└──────────────┴────────────┘
	Module                                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                                      | 8.37 KB   | 1.59 KB    | 46.1          | 4.1
	@ember-data/adapter/error                                     | 1.91 KB   | 373.35 B   | 10.5          | 0.9
	@ember-data/adapter/-private/build-url-mixin                  | 1.82 KB   | 355.82 B   | 10.1          | 0.9
	@ember-data/adapter/index                                     | 1.14 KB   | 221.84 B   | 6.3           | 0.6
	@ember-data/adapter/-private/index                            | 1.03 KB   | 201.25 B   | 5.7           | 0.5
	@ember-data/adapter/json-api                                  | 1.02 KB   | 198.78 B   | 5.6           | 0.5
	@ember-data/adapter/-private/utils/serialize-query-params     | 792.00 B  | 150.94 B   | 4.3           | 0.4
	@ember-data/adapter/-private/utils/determine-body-promise     | 549.00 B  | 104.63 B   | 3.0           | 0.3
	@ember-data/adapter/-private/utils/parse-response-headers     | 480.00 B  | 91.48 B    | 2.6           | 0.2
	@ember-data/adapter/-private/utils/fetch                      | 454.00 B  | 86.52 B    | 2.4           | 0.2
	@ember-data/adapter/-private/utils/serialize-into-hash        | 347.00 B  | 66.13 B    | 1.9           | 0.2
	@ember-data/adapter/-private/utils/continue-on-reject         | 219.00 B  | 41.73 B    | 1.2           | 0.1
	@ember-data/adapter/-private/fastboot-interface               | 76.00 B   | 14.48 B    | 0.4           | 0.0

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '9.50 KB' │
│  compressed  │ '1.81 KB' │
│ % Of Library │   '4.7'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.32 KB   | 453.40 B   | 24.5          | 1.1
	ember-data/-private/index                         | 1.93 KB   | 376.21 B   | 20.3          | 0.9
	ember-data/adapters/errors                        | 1.19 KB   | 231.94 B   | 12.5          | 0.6
	ember-data/setup-container                        | 503.00 B  | 95.86 B    | 5.2           | 0.2
	ember-data/-private/core                          | 321.00 B  | 61.17 B    | 3.3           | 0.2
	ember-data/relationships                          | 318.00 B  | 60.60 B    | 3.3           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 52.22 B    | 2.8           | 0.1
	ember-data/serializers/json-api                   | 251.00 B  | 47.83 B    | 2.6           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 46.69 B    | 2.5           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 46.31 B    | 2.5           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 46.31 B    | 2.5           | 0.1
	ember-data/transform                              | 241.00 B  | 45.93 B    | 2.5           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 45.16 B    | 2.4           | 0.1
	ember-data/serializer                             | 232.00 B  | 44.21 B    | 2.4           | 0.1
	ember-data/adapter                                | 226.00 B  | 43.07 B    | 2.3           | 0.1
	ember-data/model                                  | 222.00 B  | 42.30 B    | 2.3           | 0.1
	ember-data/store                                  | 222.00 B  | 42.30 B    | 2.3           | 0.1
	ember-data/attr                                   | 218.00 B  | 41.54 B    | 2.2           | 0.1
	ember-data/version                                | 162.00 B  | 30.87 B    | 1.7           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '6.66 KB' │
│  compressed  │ '1.27 KB' │
│ % Of Library │   '3.3'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 2.88 KB   | 562.03 B   | 43.3          | 1.4
	ember-inflector/lib/system/inflections            | 1.59 KB   | 310.08 B   | 23.9          | 0.8
	ember-inflector/index                             | 473.00 B  | 90.14 B    | 6.9           | 0.2
	ember-inflector/lib/system                        | 471.00 B  | 89.76 B    | 6.9           | 0.2
	ember-inflector/lib/helpers/pluralize             | 373.00 B  | 71.08 B    | 5.5           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 60.60 B    | 4.7           | 0.2
	ember-inflector/lib/utils/make-helper             | 308.00 B  | 58.69 B    | 4.5           | 0.1
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 56.41 B    | 4.3           | 0.1

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

@github-actions
Copy link

github-actions bot commented Jun 13, 2020

Performance Report for b44fd1d

Relationship Analysis
                        -------------

__/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
 _\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
  _\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
   _\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
    _\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
     _\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
      _\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
       _\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
        _\///______________\///______________\///__\///////////////__


                          Runtime Edition

        PM2 is a Production Process Manager for Node.js applications
                     with a built-in Load Balancer.

                Start and Daemonize any application:
                $ pm2 start app.js

                Load Balance 4 instances of api.js:
                $ pm2 start api.js -i 4

                Monitor in production:
                $ pm2 monitor

                Make pm2 auto-boot at server restart:
                $ pm2 startup

                To go further checkout:
                http://pm2.io/


                        -------------

[PM2] Spawning PM2 daemon with pm2_home=/home/runner/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /home/runner/work/data/data/bin/relationship-performance-tracking/src/har-remix.js in fork_mode (1 instance)
[PM2] Done.
┌─────┬────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name       │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ control    │ default     │ N/A     │ fork    │ 1878     │ 0s     │ 0    │ online    │ 0%       │ 33.9mb   │ runner   │ disabled │
└─────┴────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
[PM2] Starting /home/runner/work/data/data/bin/relationship-performance-tracking/src/har-remix.js in fork_mode (1 instance)
[PM2] Done.
┌─────┬───────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name          │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼───────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ control       │ default     │ N/A     │ fork    │ 1878     │ 0s     │ 0    │ online    │ 0%       │ 61.4mb   │ runner   │ disabled │
│ 1   │ experiment    │ default     │ N/A     │ fork    │ 1902     │ 0s     │ 0    │ online    │ 0%       │ 25.2mb   │ runner   │ disabled │
└─────┴───────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
01-materialization: computing results...

===============================================================================
Processing CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md README.md RELEASE.md bin lerna.json node_modules package.json packages tmp tsconfig.json yarn.lock
[PM2] Applying action deleteProcessId on app [all](ids: [ 0, 1 ])
[PM2] [control](0) ✓
[PM2] [experiment](1) ✓
[PM2] [v] All Applications Stopped
[PM2] [v] PM2 Daemon Stopped

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 a phenomenal refactor. A thought on the isError test error but not sure of a solution. Do you think we need the setter?

packages/model/addon/-private/model.js Show resolved Hide resolved
@igorT
Copy link
Member

igorT commented Aug 12, 2020

@runspired can we merge this?

@snewcomer
Copy link
Contributor

@snewcomer
Copy link
Contributor

ef4/ember-data-relationship-tracker#19

Ok final one to get these tests to pass.

Copy link
Contributor Author

@runspired runspired left a comment

Choose a reason for hiding this comment

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

Audited and it seems all of @igorT's feedback was addressed.

@runspired runspired force-pushed the refactor/native-model branch 3 times, most recently from dadb84e to 88d3550 Compare April 13, 2021 18:49
isNewCP = retrieveFromCurrentState;
}
function computeOnce(target, key, desc) {
const cache = new WeakMap();
Copy link
Member

Choose a reason for hiding this comment

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

let, no?

Copy link
Member

@igorT igorT left a comment

Choose a reason for hiding this comment

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

Left comments

Co-Authored-By: Scott Newcomer <[email protected]>

fix docs tests

getWithDefault

bad rebase

fix doc tests

add computeds

dont invalidate prop within isError

dont install tracking within our meta object

more prop cleanup

more get cleanup

cycle less on id

cycle less on id cleanup

update test

Revert "cycle less on id cleanup"

This reverts commit 173c42b.

Revert "cycle less on id"

This reverts commit 38f76aa.

less cycling but without whatever weird build issue

remove mixin if deprecation is resolved and strip deprecations for perf tests

new tests for refactoring

refactor to simpler definitions
@runspired runspired merged commit 5b92eab into master Apr 21, 2021
@delete-merged-branch delete-merged-branch bot deleted the refactor/native-model branch April 21, 2021 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ chore This PR primarily refactors code or updates dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants