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

perf: optimize unload and relationships #8149

Merged
merged 8 commits into from
Aug 25, 2022
Merged

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Aug 25, 2022

pulls latest optimizations out of #8134 to continue to ensure we understand the price of the proxies in isolation

these optimizations (and a few specific to the proxy that will stay in that PR) were enough to more than offset the loss due to proxy access being slow.

  • asserts RecordDatas give stable identifiers for relationships
  • deprecates using A on PromiseManyArray

@runspired runspired added 🎯 canary PR is targeting canary (default) 🏷️ perf PRs that improve performance in a notable way labels Aug 25, 2022
@github-actions
Copy link

github-actions bot commented Aug 25, 2022

Asset Size Report for f2ccd00

Modern Builds

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

Warnings

⚠️ The uncompressed size of the package @ember-data/store has increased by +186.0 B.
⚠️ The uncompressed size of the package @ember-data/record-data has increased by +31.0 B.

Changeset


EmberData +167.1 KB +169.0 B (+35.11 KB +26.0 B compressed)
    @ember-data/model +45.23 KB -48.0 B (+9.51 KB -7.38 B compressed)
        @ember-data/model/-private +44.76 KB -48.0 B (+9.41 KB -7.38 B compressed)
    @ember-data/store +45.24 KB +186.0 B (+9.51 KB +28.62 B compressed)
        @ember-data/store/-private +44.24 KB +186.0 B (+9.3 KB +28.62 B compressed)
    @ember-data/record-data +22.29 KB +31.0 B (+4.68 KB +4.77 B compressed)
        @ember-data/record-data/-private +22.29 KB +31.0 B (+4.68 KB +4.77 B compressed)

Full Asset Analysis (Modern)

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


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

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '45.24 KB' │
│  compressed  │ '9.51 KB'  │
│ % Of Library │   '27.1'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 44.24 KB  | 9.30 KB    | 97.8          | 26.5
	@ember-data/store/index                           | 1022.00 B | 214.76 B   | 2.2           | 0.6

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '45.23 KB' │
│  compressed  │ '9.51 KB'  │
│ % Of Library │   '27.1'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 44.76 KB  | 9.41 KB    | 99.0          | 26.8
	@ember-data/model/index                           | 486.00 B  | 102.12 B   | 1.0           | 0.3

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

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '20.42 KB' │
│  compressed  │ '4.29 KB'  │
│ % Of Library │   '12.2'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                       | 7.36 KB   | 1.55 KB    | 36.0          | 4.4
	@ember-data/serializer/-private                   | 5.60 KB   | 1.18 KB    | 27.4          | 3.3
	@ember-data/serializer/json-api                   | 3.79 KB   | 815.54 B   | 18.6          | 2.3
	@ember-data/serializer/rest                       | 2.87 KB   | 616.54 B   | 14.0          | 1.7
	@ember-data/serializer/index                      | 611.00 B  | 128.39 B   | 2.9           | 0.4
	@ember-data/serializer/transform                  | 215.00 B  | 45.17 B    | 1.0           | 0.1

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '15.93 KB' │
│  compressed  │ '3.35 KB'  │
│ % Of Library │   '9.5'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                          | 7.88 KB   | 1.66 KB    | 49.5          | 4.7
	@ember-data/adapter/-private                      | 3.79 KB   | 814.49 B   | 23.8          | 2.3
	@ember-data/adapter/error                         | 1.82 KB   | 392.11 B   | 11.4          | 1.1
	@ember-data/adapter/index                         | 1.41 KB   | 303.85 B   | 8.9           | 0.8
	@ember-data/adapter/json-api                      | 1.03 KB   | 222.53 B   | 6.5           | 0.6

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '8.55 KB' │
│  compressed  │ '1.80 KB' │
│ % Of Library │   '5.1'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.08 KB   | 446.75 B   | 24.3          | 1.2
	ember-data/-private                               | 1.67 KB   | 359.33 B   | 19.5          | 1.0
	ember-data/adapters/errors                        | 1.19 KB   | 255.73 B   | 13.9          | 0.7
	ember-data/setup-container                        | 368.00 B  | 77.33 B    | 4.2           | 0.2
	ember-data/relationships                          | 318.00 B  | 66.82 B    | 3.6           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 57.57 B    | 3.1           | 0.2
	ember-data/serializers/json-api                   | 251.00 B  | 52.74 B    | 2.9           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 51.48 B    | 2.8           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 51.06 B    | 2.8           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 51.06 B    | 2.8           | 0.1
	ember-data/transform                              | 241.00 B  | 50.64 B    | 2.8           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 49.80 B    | 2.7           | 0.1
	ember-data/serializer                             | 232.00 B  | 48.75 B    | 2.7           | 0.1
	ember-data/adapter                                | 226.00 B  | 47.49 B    | 2.6           | 0.1
	ember-data/model                                  | 222.00 B  | 46.65 B    | 2.5           | 0.1
	ember-data/store                                  | 222.00 B  | 46.65 B    | 2.5           | 0.1
	ember-data/attr                                   | 218.00 B  | 45.80 B    | 2.5           | 0.1
	ember-data/version                                | 161.00 B  | 33.83 B    | 1.8           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '6.67 KB' │
│  compressed  │ '1.40 KB' │
│ % Of Library │   '4.0'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector              | 2.96 KB   | 637.55 B   | 44.4          | 1.8
	ember-inflector/lib/system/inflections            | 1.59 KB   | 341.89 B   | 23.8          | 1.0
	ember-inflector/lib/system                        | 471.00 B  | 98.97 B    | 6.9           | 0.3
	ember-inflector/index                             | 379.00 B  | 79.64 B    | 5.6           | 0.2
	ember-inflector/lib/helpers/pluralize             | 369.00 B  | 77.54 B    | 5.4           | 0.2
	ember-inflector/lib/utils/make-helper             | 332.00 B  | 69.76 B    | 4.9           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 66.82 B    | 4.7           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 62.20 B    | 4.3           | 0.2

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.77 KB'  │
│  compressed  │ '595.31 B' │
│ % Of Library │   '1.7'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                           | 2.27 KB   | 489.19 B   | 82.2          | 1.4
	@ember-data/debug/setup                           | 505.00 B  | 106.11 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 Aug 25, 2022

Performance Report for f2ccd00

Scenario - basic-record-materialization: ✅ Performance improved

✅ duration
phase estimated improvement -38ms [-63ms to -12ms] OR -0.94% [-1.55% to -0.29%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-8ms to 1ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-3ms to 3ms]
✅ Phase [start-push-payload] => [start-peek-records]
phase estimated improvement -15ms [-29ms to -1ms] OR -0.69% [-1.34% to -0.04%]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
✅ Phase [start-record-materialization] => [end-record-materialization]
phase estimated improvement -13ms [-26ms to 0ms] OR -1.27% [-2.5% to -0.01%]
☑️ Phase [end-record-materialization] => [Test End]
phase no difference [-5ms to 5ms]

Scenario - relationship-materialization-simple: ⚠️ Performance regressed

⚠️ duration
phase estimated regression +18ms [2ms to 35ms] OR +1.45% [0.14% to 2.79%]
☑️ Phase [navigationStart] => [start-find-all]
phase no difference [-4ms to 7ms]
☑️ Phase [start-find-all] => [start-materialization]
phase no difference [-5ms to 5ms]
⚠️ Phase [start-materialization] => [end-materialization]
phase estimated regression +13ms [8ms to 17ms] OR +3.17% [2.06% to 4.26%]
☑️ Phase [end-materialization] => [Test End]
phase no difference [-1ms to 4ms]

Scenario - relationship-materialization-complex: ✅ Performance improved

✅ duration
phase estimated improvement -395ms [-457ms to -339ms] OR -6.05% [-6.99% to -5.19%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-4ms to 6ms]
⚠️ Phase [start-data-generation] => [start-push-payload]
phase estimated regression +2ms [0ms to 4ms] OR +0.91% [0.22% to 1.67%]
☑️ Phase [start-push-payload] => [start-peek-records]
phase no difference [-15ms to 0ms]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
☑️ Phase [start-record-materialization] => [start-relationship-materialization]
phase no difference [-7ms to 4ms]
✅ Phase [start-relationship-materialization] => [end-relationship-materialization]
phase estimated improvement -268ms [-322ms to -212ms] OR -6.61% [-7.95% to -5.23%]
✅ Phase [end-relationship-materialization] => [Test End]
phase estimated improvement -117ms [-125ms to -110ms] OR -22.6% [-24.1% to -21.19%]

Scenario - unload: ☑️ Performance is stable

☑️ duration
phase no difference [-16ms to 11ms]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-5ms to 8ms]
☑️ Phase [start-push-payload] => [start-unload-records]
phase no difference [-5ms to 7ms]
✅ Phase [start-unload-records] => [end-unload-records]
phase estimated improvement -3ms [-5ms to -1ms] OR -1.25% [-2.16% to -0.42%]
☑️ Phase [end-unload-records] => [Test End]
phase no difference [0ms to 1ms]

Scenario - unload-all: ☑️ Performance is stable

☑️ duration
phase no difference [-16ms to 17ms]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-8ms to 7ms]
☑️ Phase [start-push-payload] => [start-materialization]
phase no difference [-2ms to 15ms]
☑️ Phase [start-materialization] => [start-unload-all]
phase no difference [-4ms to 5ms]
✅ Phase [start-unload-all] => [end-unload-all]
phase estimated improvement -9ms [-15ms to -3ms] OR -1.91% [-3.18% to -0.69%]
☑️ Phase [end-unload-all] => [Test End]
phase no difference [0ms to 1ms]

Scenario - destroy: ☑️ Performance is stable

☑️ duration
phase no difference [-15ms to 10ms]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-7ms to 7ms]
☑️ Phase [start-push-payload] => [start-destroy-records]
phase no difference [-7ms to 4ms]
☑️ Phase [start-destroy-records] => [end-destroy-records]
phase no difference [-4ms to 1ms]
☑️ Phase [end-destroy-records] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - add-children: ☑️ Performance is stable

☑️ duration
phase no difference [-25ms to 1ms]
☑️ Phase [navigationStart] => [start-push-initial-payload]
phase no difference [-8ms to 10ms]
✅ Phase [start-push-initial-payload] => [start-push-update-payload]
phase estimated improvement -7ms [-10ms to -4ms] OR -2.57% [-3.85% to -1.46%]
✅ Phase [start-push-update-payload] => [end-push-update-payload]
phase estimated improvement -7ms [-10ms to -4ms] OR -3.12% [-4.63% to -1.6%]
☑️ Phase [end-push-update-payload] => [Test End]
phase no difference [0ms to 1ms]

Scenario - unused-relationships: ☑️ Performance is stable

☑️ duration
phase no difference [-12ms to 12ms]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-8ms to 5ms]
☑️ Phase [start-push-payload] => [end-push-payload]
phase no difference [-4ms to 6ms]
☑️ Phase [end-push-payload] => [Test End]
phase no difference [-1ms to 1ms]

@runspired runspired merged commit a1fe9d1 into master Aug 25, 2022
@delete-merged-branch delete-merged-branch bot deleted the runspired/optimizations branch August 25, 2022 22:19
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) 🏷️ perf PRs that improve performance in a notable way
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant