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

Love of Mine #8084

Merged
merged 29 commits into from Aug 9, 2022
Merged

Love of Mine #8084

merged 29 commits into from Aug 9, 2022

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Jul 27, 2022

Continuing on #8078. The primary goal for this PR will be to eliminate InternalModel's role in determining what records are potentially loaded and available.

  • eliminated the InteralModelMap and the IdentityMap
  • (re)discovered how we rely on keeping an identifier in the cache but removing it from the "all" list to deal with some unload shennanigans. Unsure if this is something we need to rationalize and keep or something that we can delete once InternalModel is fully gone. Kept for now with a comment.
  • eliminated the role of InternalModel in preloading
  • eliminated two-pass destroy (which is there due to InternalModel)
  • eliminated role of InternalModel/store in rollback/setupData/changeAttributes+notifications
  • eliminated internalmodel role in ID management
  • eliminated internalmodel role in destroy
  • eliminated internalmodel role in adatperDidInvalidate
  • eliminated internalmodel role in state determination
  • eliminated InternalModelFactory
  • eliminated InternalModel

Notes for the release

  • (ab)users of the internalModel api will be in for a rough time. It will be gone.
  • implements PromiseManyArray deprecation RFC rfc: ember-data | Modernize PromiseManyArray rfcs#745
  • implements a new (public) debugging API. In dev builds, your ember-cli-build file can specify behaviors to log. Current EmberData config is shown below. This instrumentation is removed entirely if the value if false or the build is for production.
  • The transfer of responsibility for the ManyArray/PromiseProxies from InternalModel to Model changes five things around teardown that could have significant public affects. Steps have been taken to minimize these affects but whether those steps are enough won't be clear until this is in use. Those fice things are that (1) ManyArray and proxies are torn down with the model, so they are in a destroyed state sooner, and accessing them during a destroy (which is sometimes common) can put you in an error state that would have happened to have worked before (though would have been a bug). (2) In the past even if a relationship had never been accessed ever you could access its relationships safely post-destroy due to the InternalModel having been retained and allowing relationships to be materialized for even destroyed records. Since nothing is retained anymore, this is no longer safe. (3) accessing any state from the store/cache once destroyed is an error. We guard some of these to try to preserve "disconnected but still accessible" semantics as much as possible, but ultimately if a record has been destroyed accessing its properties is a bug. (4) We more fully and more often purge all data for a record on unload/destroy, apps relying on retention may see subtle reference bugs if they were relying on it, especially true for Identifier equality checks. (5) Records once destroyed are fully destroyed. In the past, if we retained an InternalModel then you would secretly get the same proxies and ManyArray on rematerialization, now you will not. Some reference checks may now fail.
  let app = new EmberApp(defaults, {
    emberData: {
      compatWith: '4.8',
      debug: {
          LOG_NOTIFICATIONS: false,
          LOG_REQUEST_STATUS: false,
          LOG_IDENTIFIERS: false,
          LOG_GRAPH: false,
          LOG_INSTANCE_CACHE: false,
      }
    }
  });

@github-actions
Copy link

github-actions bot commented Jul 27, 2022

Asset Size Report for 8910696

Modern Builds

✅ EmberData shrank by -7.15 KB (-1.4 KB compressed)

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

Changeset


EmberData +170.63 KB -7.15 KB (+35.68 KB -1.4 KB compressed)
    @ember-data/store +45.29 KB -5.72 KB (+9.47 KB -1.12 KB compressed)
        @ember-data/store/-private +44.29 KB -5.72 KB (+9.26 KB -1.12 KB compressed)
    @ember-data/model +46.89 KB -358.0 B (+9.8 KB -70.03 B compressed)
        @ember-data/model/-private +46.42 KB -358.0 B (+9.71 KB -70.03 B compressed)
    @ember-data/record-data +24.01 KB -526.0 B (+5.02 KB -102.9 B compressed)
        @ember-data/record-data/-private +24.01 KB -526.0 B (+5.02 KB -102.9 B compressed)
    @ember-data/serializer +20.42 KB -312.0 B (+4.27 KB -61.04 B compressed)
        @ember-data/serializer/json +7.36 KB -200.0 B (+1.54 KB -39.13 B compressed)
        @ember-data/serializer/-private +5.6 KB -76.0 B (+1.17 KB -14.87 B compressed)
        @ember-data/serializer/json-api +3.79 KB -7.0 B (+811.43 B -1.37 B compressed)
        @ember-data/serializer/rest +2.87 KB -29.0 B (+613.43 B -5.67 B compressed)
    ember-data +8.66 KB -116.0 B (+1.81 KB -22.69 B compressed)
        ember-data/index +2.11 KB -35.0 B (+451.39 B -6.85 B compressed)
        ember-data/-private +1.75 KB -81.0 B (+374.03 B -15.85 B compressed)
    @ember-data/debug +2.77 KB -148.0 B (+592.31 B -28.95 B compressed)
        @ember-data/debug/index +2.27 KB -148.0 B (+486.72 B -28.95 B compressed)

Full Asset Analysis (Modern)

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


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

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '46.89 KB' │
│  compressed  │ '9.80 KB'  │
│ % Of Library │   '27.5'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 46.42 KB  | 9.71 KB    | 99.0          | 27.2
	@ember-data/model/index                           | 486.00 B  | 101.61 B   | 1.0           | 0.3

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '45.29 KB' │
│  compressed  │ '9.47 KB'  │
│ % Of Library │   '26.5'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 44.29 KB  | 9.26 KB    | 97.8          | 26.0
	@ember-data/store/index                           | 1022.00 B | 213.67 B   | 2.2           | 0.6

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

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '20.42 KB' │
│  compressed  │ '4.27 KB'  │
│ % Of Library │   '12.0'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                       | 7.36 KB   | 1.54 KB    | 36.0          | 4.3
	@ember-data/serializer/-private                   | 5.60 KB   | 1.17 KB    | 27.4          | 3.3
	@ember-data/serializer/json-api                   | 3.79 KB   | 811.43 B   | 18.6          | 2.2
	@ember-data/serializer/rest                       | 2.87 KB   | 613.43 B   | 14.0          | 1.7
	@ember-data/serializer/index                      | 611.00 B  | 127.74 B   | 2.9           | 0.3
	@ember-data/serializer/transform                  | 215.00 B  | 44.95 B    | 1.0           | 0.1

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '15.93 KB' │
│  compressed  │ '3.33 KB'  │
│ % Of Library │   '9.3'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                          | 7.88 KB   | 1.65 KB    | 49.5          | 4.6
	@ember-data/adapter/-private                      | 3.79 KB   | 810.38 B   | 23.8          | 2.2
	@ember-data/adapter/error                         | 1.82 KB   | 390.13 B   | 11.4          | 1.1
	@ember-data/adapter/index                         | 1.41 KB   | 302.32 B   | 8.9           | 0.8
	@ember-data/adapter/json-api                      | 1.03 KB   | 221.41 B   | 6.5           | 0.6

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '8.66 KB' │
│  compressed  │ '1.81 KB' │
│ % Of Library │   '5.1'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.11 KB   | 451.39 B   | 24.4          | 1.2
	ember-data/-private                               | 1.75 KB   | 374.03 B   | 20.2          | 1.0
	ember-data/adapters/errors                        | 1.19 KB   | 254.44 B   | 13.7          | 0.7
	ember-data/setup-container                        | 368.00 B  | 76.94 B    | 4.2           | 0.2
	ember-data/relationships                          | 318.00 B  | 66.48 B    | 3.6           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 57.28 B    | 3.1           | 0.2
	ember-data/serializers/json-api                   | 251.00 B  | 52.47 B    | 2.8           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 51.22 B    | 2.8           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 50.80 B    | 2.7           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 50.80 B    | 2.7           | 0.1
	ember-data/transform                              | 241.00 B  | 50.38 B    | 2.7           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 49.55 B    | 2.7           | 0.1
	ember-data/serializer                             | 232.00 B  | 48.50 B    | 2.6           | 0.1
	ember-data/adapter                                | 226.00 B  | 47.25 B    | 2.5           | 0.1
	ember-data/model                                  | 222.00 B  | 46.41 B    | 2.5           | 0.1
	ember-data/store                                  | 222.00 B  | 46.41 B    | 2.5           | 0.1
	ember-data/attr                                   | 218.00 B  | 45.57 B    | 2.5           | 0.1
	ember-data/version                                | 161.00 B  | 33.66 B    | 1.8           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '6.67 KB' │
│  compressed  │ '1.39 KB' │
│ % Of Library │   '3.9'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 2.96 KB   | 634.33 B   | 44.4          | 1.7
	ember-inflector/lib/system/inflections            | 1.59 KB   | 340.16 B   | 23.8          | 0.9
	ember-inflector/lib/system                        | 471.00 B  | 98.47 B    | 6.9           | 0.3
	ember-inflector/index                             | 379.00 B  | 79.24 B    | 5.6           | 0.2
	ember-inflector/lib/helpers/pluralize             | 369.00 B  | 77.14 B    | 5.4           | 0.2
	ember-inflector/lib/utils/make-helper             | 332.00 B  | 69.41 B    | 4.9           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 66.48 B    | 4.7           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 61.88 B    | 4.3           | 0.2

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.77 KB'  │
│  compressed  │ '592.31 B' │
│ % Of Library │   '1.6'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                           | 2.27 KB   | 486.72 B   | 82.2          | 1.3
	@ember-data/debug/setup                           | 505.00 B  | 105.58 B   | 17.8          | 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 27, 2022

Performance Report for 8910696

Scenario - materialization: ✅ Performance improved

✅ duration
phase estimated improvement -84ms [-111ms to -56ms] OR -5.96% [-7.83% to -3.93%]
☑️ Phase [navigationStart] => [start-find-all]
phase no difference [-6ms to 10ms]
✅ Phase [start-find-all] => [start-materialization]
phase estimated improvement -39ms [-51ms to -26ms] OR -6.86% [-8.94% to -4.6%]
✅ Phase [start-materialization] => [end-materialization]
phase estimated improvement -25ms [-34ms to -15ms] OR -5.85% [-7.97% to -3.64%]
✅ Phase [end-materialization] => [Test End]
phase estimated improvement -13ms [-18ms to -8ms] OR -9.71% [-13.83% to -5.83%]

Scenario - unload: ✅ Performance improved

✅ duration
phase estimated improvement -103ms [-135ms to -70ms] OR -6.29% [-8.24% to -4.26%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-8ms to 20ms]
✅ Phase [start-push-payload] => [start-unload-records]
phase estimated improvement -15ms [-30ms to 0ms] OR -1.98% [-4% to -0.01%]
✅ Phase [start-unload-records] => [end-unload-records]
phase estimated improvement -90ms [-96ms to -84ms] OR -25.65% [-27.33% to -23.97%]
☑️ Phase [end-unload-records] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - destroy: ✅ Performance improved

✅ duration
phase estimated improvement -136ms [-168ms to -106ms] OR -7.26% [-8.99% to -5.65%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-2ms to 32ms]
✅ Phase [start-push-payload] => [start-destroy-records]
phase estimated improvement -31ms [-45ms to -16ms] OR -3.81% [-5.6% to -2%]
✅ Phase [start-destroy-records] => [end-destroy-records]
phase estimated improvement -119ms [-125ms to -113ms] OR -22.27% [-23.38% to -21.24%]
☑️ Phase [end-destroy-records] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - add-children: ✅ Performance improved

✅ duration
phase estimated improvement -86ms [-99ms to -73ms] OR -8.02% [-9.24% to -6.77%]
✅ Phase [navigationStart] => [start-push-initial-payload]
phase estimated improvement -28ms [-39ms to -14ms] OR -4.97% [-7.11% to -2.57%]
✅ Phase [start-push-initial-payload] => [start-push-update-payload]
phase estimated improvement -26ms [-29ms to -22ms] OR -7.93% [-8.95% to -6.83%]
✅ Phase [start-push-update-payload] => [end-push-update-payload]
phase estimated improvement -16ms [-18ms to -13ms] OR -11.67% [-13.33% to -9.89%]
✅ Phase [end-push-update-payload] => [Test End]
phase estimated improvement -17ms [-18ms to -17ms] OR -29.22% [-30.06% to -28.46%]

Scenario - unused-relationships: ✅ Performance improved

✅ duration
phase estimated improvement -35ms [-66ms to -2ms] OR -2.54% [-4.87% to -0.14%]
⚠️ Phase [navigationStart] => [start-push-payload]
phase estimated regression +31ms [18ms to 46ms] OR +6.64% [3.84% to 9.64%]
✅ Phase [start-push-payload] => [end-push-payload]
phase estimated improvement -38ms [-58ms to -17ms] OR -4.66% [-7.17% to -2.1%]
✅ Phase [end-push-payload] => [Test End]
phase estimated improvement -26ms [-29ms to -24ms] OR -36.16% [-40.03% to -33.54%]

@runspired runspired force-pushed the runspired/the-thrilling-conclusion branch from 8e91c0a to 473893f Compare July 27, 2022 23:47
@runspired runspired added 🎯 canary PR is targeting canary (default) 🏷️ chore This PR primarily refactors code or updates dependencies labels Jul 28, 2022
@runspired runspired force-pushed the runspired/the-thrilling-conclusion branch from a0afcc3 to ee62785 Compare July 31, 2022 03:09
@runspired runspired added this to In Development in 🌲 Project Trim 🌲 via automation Aug 5, 2022
@runspired runspired mentioned this pull request Aug 5, 2022
65 tasks
@runspired runspired added this to In Development in 🔌 Project Unplug 🔌 via automation Aug 5, 2022
@runspired runspired merged commit 7e66606 into master Aug 9, 2022
🌲 Project Trim 🌲 automation moved this from In Development to Completed Aug 9, 2022
🔌 Project Unplug 🔌 automation moved this from In Development to Completed Aug 9, 2022
@delete-merged-branch delete-merged-branch bot deleted the runspired/the-thrilling-conclusion branch August 9, 2022 08:12
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 🏷️ deprecation
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

None yet

1 participant