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

feat: efficient manager #8135

Merged
merged 4 commits into from
Aug 19, 2022
Merged

feat: efficient manager #8135

merged 4 commits into from
Aug 19, 2022

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Aug 19, 2022

This is a complementary PR to #8134 which prepares the RecordArrayManager to better support RecordArray's built using Native Proxies. It also improves performance out-of-the-box by eliminating full-traversals of the store's huge array when doing partial updates to the RecordArray.

Users can expect up to 50% faster RecordArray updates and and initial value calculations (the return value of findAll and peekAll). These changes also improve the cost of record instantiation. In an app running in latest Chrome on ubuntu loading 100k records this would save ~425ms.

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

github-actions bot commented Aug 19, 2022

Asset Size Report for d73d666

Modern Builds

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

Warnings

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

Changeset


EmberData +168.81 KB +167.0 B (+35.32 KB +56.0 B compressed)
    @ember-data/store +46.87 KB +167.0 B (+9.81 KB +56.0 B compressed)
        @ember-data/store/-private +45.88 KB +167.0 B (+9.6 KB +56.0 B compressed)

Full Asset Analysis (Modern)

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


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

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '46.87 KB' │
│  compressed  │ '9.81 KB'  │
│ % Of Library │   '27.8'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 45.88 KB  | 9.60 KB    | 97.9          | 27.2
	@ember-data/store/index                           | 1022.00 B | 213.84 B   | 2.1           | 0.6

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '45.36 KB' │
│  compressed  │ '9.49 KB'  │
│ % Of Library │   '26.9'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 44.88 KB  | 9.39 KB    | 99.0          | 26.6
	@ember-data/model/index                           | 486.00 B  | 101.69 B   | 1.0           | 0.3

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

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

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

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '8.55 KB' │
│  compressed  │ '1.79 KB' │
│ % Of Library │   '5.1'   │
└──────────────┴───────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                                  | 2.08 KB   | 444.84 B   | 24.3          | 1.2
	ember-data/-private                               | 1.67 KB   | 357.80 B   | 19.5          | 1.0
	ember-data/adapters/errors                        | 1.19 KB   | 254.64 B   | 13.9          | 0.7
	ember-data/setup-container                        | 368.00 B  | 77.00 B    | 4.2           | 0.2
	ember-data/relationships                          | 318.00 B  | 66.53 B    | 3.6           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 57.33 B    | 3.1           | 0.2
	ember-data/serializers/json-api                   | 251.00 B  | 52.51 B    | 2.9           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 51.26 B    | 2.8           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 50.84 B    | 2.8           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 50.84 B    | 2.8           | 0.1
	ember-data/transform                              | 241.00 B  | 50.42 B    | 2.8           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 49.58 B    | 2.7           | 0.1
	ember-data/serializer                             | 232.00 B  | 48.54 B    | 2.7           | 0.1
	ember-data/adapter                                | 226.00 B  | 47.28 B    | 2.6           | 0.1
	ember-data/model                                  | 222.00 B  | 46.45 B    | 2.5           | 0.1
	ember-data/store                                  | 222.00 B  | 46.45 B    | 2.5           | 0.1
	ember-data/attr                                   | 218.00 B  | 45.61 B    | 2.5           | 0.1
	ember-data/version                                | 161.00 B  | 33.68 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.83 B   | 44.4          | 1.8
	ember-inflector/lib/system/inflections            | 1.59 KB   | 340.43 B   | 23.8          | 0.9
	ember-inflector/lib/system                        | 471.00 B  | 98.55 B    | 6.9           | 0.3
	ember-inflector/index                             | 379.00 B  | 79.30 B    | 5.6           | 0.2
	ember-inflector/lib/helpers/pluralize             | 369.00 B  | 77.20 B    | 5.4           | 0.2
	ember-inflector/lib/utils/make-helper             | 332.00 B  | 69.46 B    | 4.9           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 66.53 B    | 4.7           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 61.93 B    | 4.3           | 0.2

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

Performance Report for d73d666

Scenario - basic-record-materialization: ✅ Performance improved

✅ duration
phase estimated improvement -613ms [-650ms to -566ms] OR -11.44% [-12.13% to -10.56%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-7ms to 2ms]
⚠️ Phase [start-data-generation] => [start-push-payload]
phase estimated regression +4ms [0ms to 7ms] OR +0.74% [0.09% to 1.39%]
✅ Phase [start-push-payload] => [start-peek-records]
phase estimated improvement -27ms [-44ms to -12ms] OR -1% [-1.64% to -0.45%]
✅ Phase [start-peek-records] => [start-record-materialization]
phase estimated improvement -49ms [-51ms to -47ms] OR -53.67% [-56.34% to -51.5%]
✅ Phase [start-record-materialization] => [end-record-materialization]
phase estimated improvement -361ms [-406ms to -52ms] OR -22.89% [-25.7% to -3.31%]
✅ Phase [end-record-materialization] => [Test End]
phase estimated improvement -131ms [-136ms to -124ms] OR -72.78% [-75.92% to -68.85%]

Scenario - relationship-materialization-simple: ✅ Performance improved

✅ duration
phase estimated improvement -19ms [-32ms to -7ms] OR -1.54% [-2.54% to -0.59%]
☑️ Phase [navigationStart] => [start-find-all]
phase no difference [-5ms to 3ms]
✅ Phase [start-find-all] => [start-materialization]
phase estimated improvement -19ms [-23ms to -14ms] OR -3.76% [-4.65% to -2.76%]
☑️ Phase [start-materialization] => [end-materialization]
phase no difference [-3ms to 5ms]
☑️ Phase [end-materialization] => [Test End]
phase no difference [0ms to 0ms]

Scenario - relationship-materialization-complex: ✅ Performance improved

✅ duration
phase estimated improvement -129ms [-172ms to -88ms] OR -1.91% [-2.55% to -1.31%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-4ms to 4ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-2ms to 2ms]
☑️ Phase [start-push-payload] => [start-peek-records]
phase no difference [-12ms to 9ms]
✅ Phase [start-peek-records] => [start-record-materialization]
phase estimated improvement -13ms [-16ms to -12ms] OR -34.6% [-44.53% to -31.85%]
✅ Phase [start-record-materialization] => [start-relationship-materialization]
phase estimated improvement -12ms [-17ms to -6ms] OR -2.16% [-3.06% to -1.14%]
✅ Phase [start-relationship-materialization] => [end-relationship-materialization]
phase estimated improvement -74ms [-103ms to -45ms] OR -2% [-2.81% to -1.22%]
✅ Phase [end-relationship-materialization] => [Test End]
phase estimated improvement -32ms [-38ms to -26ms] OR -5.2% [-6.08% to -4.14%]

Scenario - unload: ✅ Performance improved

✅ duration
phase estimated improvement -24ms [-37ms to -11ms] OR -1.58% [-2.45% to -0.74%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-6ms to 3ms]
☑️ Phase [start-push-payload] => [start-unload-records]
phase no difference [-5ms to 6ms]
✅ Phase [start-unload-records] => [end-unload-records]
phase estimated improvement -18ms [-20ms to -16ms] OR -7.19% [-8.02% to -6.42%]
☑️ Phase [end-unload-records] => [Test End]
phase no difference [0ms to 0ms]

Scenario - unload-all: ✅ Performance improved

✅ duration
phase estimated improvement -128ms [-150ms to -103ms] OR -3.51% [-4.12% to -2.83%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-10ms to 6ms]
✅ Phase [start-push-payload] => [start-materialization]
phase estimated improvement -35ms [-47ms to -23ms] OR -2.13% [-2.87% to -1.42%]
✅ Phase [start-materialization] => [start-unload-all]
phase estimated improvement -41ms [-48ms to -33ms] OR -5.43% [-6.42% to -4.36%]
✅ Phase [start-unload-all] => [end-unload-all]
phase estimated improvement -48ms [-54ms to -43ms] OR -8.25% [-9.21% to -7.29%]
✅ Phase [end-unload-all] => [Test End]
phase estimated improvement -1ms [-1ms to 0ms] OR -2.3% [-3.35% to -1.08%]

Scenario - destroy: ✅ Performance improved

✅ duration
phase estimated improvement -29ms [-42ms to -16ms] OR -1.99% [-2.85% to -1.1%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-9ms to 2ms]
☑️ Phase [start-push-payload] => [start-destroy-records]
phase no difference [-12ms to 0ms]
✅ Phase [start-destroy-records] => [end-destroy-records]
phase estimated improvement -19ms [-22ms to -16ms] OR -8.54% [-9.78% to -7.29%]
✅ Phase [end-destroy-records] => [Test End]
phase estimated improvement -1ms [-1ms to 0ms] OR -1.38% [-2.2% to -0.53%]

Scenario - add-children: ✅ Performance improved

✅ duration
phase estimated improvement -31ms [-41ms to -21ms] OR -2.87% [-3.78% to -1.97%]
☑️ Phase [navigationStart] => [start-push-initial-payload]
phase no difference [-7ms to 7ms]
✅ Phase [start-push-initial-payload] => [start-push-update-payload]
phase estimated improvement -4ms [-6ms to -1ms] OR -1.24% [-2.2% to -0.3%]
✅ Phase [start-push-update-payload] => [end-push-update-payload]
phase estimated improvement -5ms [-8ms to -2ms] OR -2.03% [-3.2% to -0.82%]
✅ Phase [end-push-update-payload] => [Test End]
phase estimated improvement -24ms [-25ms to -24ms] OR -39.6% [-40.36% to -38.87%]

Scenario - unused-relationships: ✅ Performance improved

✅ duration
phase estimated improvement -18ms [-29ms to -7ms] OR -1.44% [-2.31% to -0.58%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-7ms to 4ms]
☑️ Phase [start-push-payload] => [end-push-payload]
phase no difference [-1ms to 10ms]
✅ Phase [end-push-payload] => [Test End]
phase estimated improvement -20ms [-21ms to -19ms] OR -33.94% [-35.27% to -32.56%]

@runspired runspired merged commit ce5a6e3 into master Aug 19, 2022
@delete-merged-branch delete-merged-branch bot deleted the runspired/efficient-manager branch August 19, 2022 07:30
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