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

chore: InternalModel burndown #8078

Merged
merged 16 commits into from
Jul 27, 2022
Merged

chore: InternalModel burndown #8078

merged 16 commits into from
Jul 27, 2022

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Jul 26, 2022

Picks up where #8055 left off

  • continues to simplify remaining store APIs and align them to the coming network layer rationalization
  • continues to replace InternalModel usage with Identifier usage (there's some friction here as we figure out where to store state that isn't necessarily related to DSModel and required for proper book-keeping)
  • identifies some locations where code could be conditionally removed if the model package is not present to give those consumers significant savings (core of ED is ~10KB if not using the legacy stuff once this lands)

Big goal for this PR is to get relationship state classes out of core and into the model package. A still unanswered question is what to do with references. This has been a circular debate on the core team in the past, the war of attrition suggests my path forward is the one we take (references should die with @ember-data/model) though I'm open to other paths forward. My reasoning is that directly asking the cache for relationship information is more useful, and we can expose the Graph as public API in the future if we so choose (again more useful). References were always little more than a workaround for the messiness of async relationships, and if those are dying anyway there's not much reason to keep them around in my mind.


Important release note: users of only the core of ember-data (for instance users of ember-m3) can expect the total size to shrink between 35-50% once upgrading to a release with these changes and those in #8055

@github-actions
Copy link

github-actions bot commented Jul 26, 2022

Asset Size Report for e9fe99f

Modern Builds

✅ EmberData shrank by -183.0 B (-317.0 B compressed)

Warnings

⚠️ The uncompressed size of the package @ember-data/model has increased by +16.19 KB.
⚠️ The uncompressed size of the package @ember-data/record-data has increased by +149.0 B.
⚠️ The uncompressed size of the package @ember-data/debug has increased by +60.0 B.

Changeset


EmberData +178.68 KB -183.0 B (+37.25 KB -317.0 B compressed)
    @ember-data/store +51.95 KB -16.57 KB (+10.83 KB -28.71 KB compressed)
        @ember-data/store/-private +50.95 KB -16.57 KB (+10.62 KB -28.71 KB compressed)
    @ember-data/model +47.19 KB +16.19 KB (+9.84 KB +28.04 KB compressed)
        @ember-data/model/-private +46.72 KB +16.19 KB (+9.74 KB +28.04 KB compressed)
    @ember-data/record-data +24.53 KB +149.0 B (+5.11 KB +258.1 B compressed)
        @ember-data/record-data/-private +24.53 KB +149.0 B (+5.11 KB +258.1 B compressed)
    @ember-data/debug +2.91 KB +60.0 B (+621.49 B +103.93 B compressed)
        @ember-data/debug/index +2.42 KB +60.0 B (+516.2 B +103.93 B compressed)

Full Asset Analysis (Modern)

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


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

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '51.95 KB' │
│  compressed  │ '10.83 KB' │
│ % Of Library │   '29.1'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 50.95 KB  | 10.62 KB   | 98.1          | 28.5
	@ember-data/store/index                           | 1022.00 B | 213.07 B   | 1.9           | 0.6

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '47.19 KB' │
│  compressed  │ '9.84 KB'  │
│ % Of Library │   '26.4'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 46.72 KB  | 9.74 KB    | 99.0          | 26.1
	@ember-data/model/index                           | 486.00 B  | 101.32 B   | 1.0           | 0.3

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

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '20.57 KB' │
│  compressed  │ '4.29 KB'  │
│ % Of Library │   '11.5'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                       | 7.34 KB   | 1.53 KB    | 35.7          | 4.1
	@ember-data/serializer/-private                   | 5.67 KB   | 1.18 KB    | 27.6          | 3.2
	@ember-data/serializer/json-api                   | 3.83 KB   | 817.05 B   | 18.6          | 2.1
	@ember-data/serializer/rest                       | 2.93 KB   | 626.07 B   | 14.3          | 1.6
	@ember-data/serializer/index                      | 611.00 B  | 127.38 B   | 2.9           | 0.3
	@ember-data/serializer/transform                  | 215.00 B  | 44.82 B    | 1.0           | 0.1

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '16.09 KB' │
│  compressed  │ '3.35 KB'  │
│ % Of Library │   '9.0'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                          | 7.88 KB   | 1.64 KB    | 49.0          | 4.4
	@ember-data/adapter/-private                      | 3.77 KB   | 805.37 B   | 23.4          | 2.1
	@ember-data/adapter/error                         | 1.99 KB   | 425.09 B   | 12.4          | 1.1
	@ember-data/adapter/index                         | 1.41 KB   | 301.46 B   | 8.8           | 0.8
	@ember-data/adapter/json-api                      | 1.03 KB   | 220.78 B   | 6.4           | 0.6

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '8.77 KB' │
│  compressed  │ '1.83 KB' │
│ % Of Library │   '4.9'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.14 KB   | 457.41 B   | 24.4          | 1.2
	ember-data/-private                               | 1.83 KB   | 389.86 B   | 20.8          | 1.0
	ember-data/adapters/errors                        | 1.19 KB   | 253.72 B   | 13.5          | 0.7
	ember-data/setup-container                        | 368.00 B  | 76.72 B    | 4.1           | 0.2
	ember-data/relationships                          | 318.00 B  | 66.29 B    | 3.5           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 57.12 B    | 3.1           | 0.1
	ember-data/serializers/json-api                   | 251.00 B  | 52.32 B    | 2.8           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 51.07 B    | 2.7           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 50.66 B    | 2.7           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 50.66 B    | 2.7           | 0.1
	ember-data/transform                              | 241.00 B  | 50.24 B    | 2.7           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 49.41 B    | 2.6           | 0.1
	ember-data/serializer                             | 232.00 B  | 48.36 B    | 2.6           | 0.1
	ember-data/adapter                                | 226.00 B  | 47.11 B    | 2.5           | 0.1
	ember-data/model                                  | 222.00 B  | 46.28 B    | 2.5           | 0.1
	ember-data/store                                  | 222.00 B  | 46.28 B    | 2.5           | 0.1
	ember-data/attr                                   | 218.00 B  | 45.44 B    | 2.4           | 0.1
	ember-data/version                                | 161.00 B  | 33.56 B    | 1.8           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '6.67 KB' │
│  compressed  │ '1.39 KB' │
│ % Of Library │   '3.7'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 2.96 KB   | 632.53 B   | 44.4          | 1.7
	ember-inflector/lib/system/inflections            | 1.59 KB   | 339.20 B   | 23.8          | 0.9
	ember-inflector/lib/system                        | 471.00 B  | 98.19 B    | 6.9           | 0.3
	ember-inflector/index                             | 379.00 B  | 79.01 B    | 5.6           | 0.2
	ember-inflector/lib/helpers/pluralize             | 369.00 B  | 76.93 B    | 5.4           | 0.2
	ember-inflector/lib/utils/make-helper             | 332.00 B  | 69.21 B    | 4.9           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 66.29 B    | 4.7           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 61.71 B    | 4.3           | 0.2

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.91 KB'  │
│  compressed  │ '621.49 B' │
│ % Of Library │   '1.6'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                           | 2.42 KB   | 516.20 B   | 83.1          | 1.4
	@ember-data/debug/setup                           | 505.00 B  | 105.28 B   | 16.9          | 0.3

Modern Builds (No Rollup)

☑️ EmberData has not changed in size

If any packages had changed sizes they would be listed here.

Changeset



Full Asset Analysis (Modern)

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


Library: EmberData
┌────────────┬──────────┐
│  (index)   │  Values  │
├────────────┼──────────┤
│   bytes    │ '0.00 B' │
│ compressed │ '1.00 B' │
│  packages  │    0     │
│  modules   │    0     │
└────────────┴──────────┘

@github-actions
Copy link

github-actions bot commented Jul 26, 2022

Performance Report for e9fe99f

Scenario - materialization: ☑️ Performance is stable

☑️ duration
phase no difference [-2ms to 33ms]
☑️ Phase [navigationStart] => [start-find-all]
phase no difference [-3ms to 4ms]
☑️ Phase [start-find-all] => [start-materialization]
phase no difference [-11ms to 0ms]
⚠️ Phase [start-materialization] => [end-materialization]
phase estimated regression +22ms [18ms to 25ms] OR +5.94% [4.86% to 7.02%]
☑️ Phase [end-materialization] => [Test End]
phase no difference [-5ms to 1ms]

Scenario - unload: ✅ Performance improved

✅ duration
phase estimated improvement -43ms [-56ms to -32ms] OR -2.85% [-3.7% to -2.1%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-5ms to 3ms]
✅ Phase [start-push-payload] => [start-unload-records]
phase estimated improvement -49ms [-54ms to -44ms] OR -6.4% [-7.04% to -5.81%]
⚠️ Phase [start-unload-records] => [end-unload-records]
phase estimated regression +8ms [5ms to 10ms] OR +2.49% [1.67% to 3.27%]
☑️ Phase [end-unload-records] => [Test End]
phase no difference [0ms to 0ms]

Scenario - destroy: ✅ Performance improved

✅ duration
phase estimated improvement -28ms [-41ms to -14ms] OR -1.67% [-2.45% to -0.84%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-3ms to 8ms]
✅ Phase [start-push-payload] => [start-destroy-records]
phase estimated improvement -49ms [-54ms to -44ms] OR -6.44% [-7.08% to -5.82%]
⚠️ Phase [start-destroy-records] => [end-destroy-records]
phase estimated regression +14ms [11ms to 18ms] OR +3.2% [2.54% to 3.91%]
☑️ Phase [end-destroy-records] => [Test End]
phase no difference [0ms to 0ms]

Scenario - add-children: ✅ Performance improved

✅ duration
phase estimated improvement -12ms [-24ms to -3ms] OR -1.29% [-2.46% to -0.26%]
☑️ Phase [navigationStart] => [start-push-initial-payload]
phase no difference [-16ms to 3ms]
✅ Phase [start-push-initial-payload] => [start-push-update-payload]
phase estimated improvement -5ms [-8ms to -3ms] OR -1.92% [-2.74% to -1.06%]
⚠️ Phase [start-push-update-payload] => [end-push-update-payload]
phase estimated regression +3ms [0ms to 5ms] OR +2.38% [0.13% to 4.37%]
✅ Phase [end-push-update-payload] => [Test End]
phase estimated improvement -4ms [-4ms to -3ms] OR -6.49% [-7.9% to -5.15%]

Scenario - unused-relationships: ✅ Performance improved

✅ duration
phase estimated improvement -65ms [-78ms to -52ms] OR -5.22% [-6.21% to -4.18%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-12ms to 0ms]
✅ Phase [start-push-payload] => [end-push-payload]
phase estimated improvement -45ms [-50ms to -39ms] OR -6% [-6.65% to -5.3%]
✅ Phase [end-push-payload] => [Test End]
phase estimated improvement -11ms [-13ms to -9ms] OR -14.75% [-17.49% to -11.82%]

@runspired runspired added 🎯 canary PR is targeting canary (default) 🏷️ cleanup This PR primarily removes deprecated functionality 🏷️ chore This PR primarily refactors code or updates dependencies labels Jul 26, 2022
@runspired runspired merged commit ebe2c1a into master Jul 27, 2022
@delete-merged-branch delete-merged-branch bot deleted the runspired/im-burndown-2 branch July 27, 2022 11:09
@runspired runspired mentioned this pull request Jul 27, 2022
@sandstrom
Copy link
Contributor

References were always little more than a workaround for the messiness of async relationships, and if those are dying anyway there's not much reason to keep them around in my mind.

Just curious, does this mean that there are plans to remove the concept of async relationships?

@runspired
Copy link
Contributor Author

@sandstrom yes! Hopefully for 5.0 this fall (see #8086) but definitely within the year. Basically any replacement to @ember-data/model will not include belongsTo and hasMany in the form they exist today.

@runspired runspired mentioned this pull request Dec 7, 2022
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 canary PR is targeting canary (default) 🏷️ chore This PR primarily refactors code or updates dependencies 🏷️ cleanup This PR primarily removes deprecated functionality
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants