data icon indicating copy to clipboard operation
data copied to clipboard

v2.1 cache

Open runspired opened this issue 2 years ago • 3 comments

Performance (and size) will get worse before they get better for this feature. Since we have to wrap every single RecordData in a unique manager so long as V1 exists, I would expect this to initially negate a significant portion of the (sizeable) improvements from the simplification work and removal of InternalModel.

However!

Since the fully v2 cache world is capable of being a singleton (and our implementation will be so), once v1 is not in the system we drop from 2N classes to support N records in the cache to two class instances (total). It is at that point I would expect to see us regain double what we lost from adding in the manager.

My hope is that we can produce a mechanism such that an app may signal that V1 is not in use, which our standard build infra will then make use of to remove the expensive codepath and utilize the cheap one. Ideally this will all be in place prior to merging this PR.

Release Notes

  • Documents the Cache (v1 and v2)
  • Implements Cache v2
  • Deprecates Cache v1

runspired avatar Aug 13 '22 09:08 runspired

this PR replaces #5931

runspired avatar Aug 13 '22 09:08 runspired

Asset Size Report for 36340c864bb7effdb18abc51418f77f7e86efbd9

Modern Builds

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

Warnings

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

Changeset


EmberData +170.15 KB +3.34 KB (+35.48 KB +551.0 B compressed)
    @ember-data/model +45.34 KB -434.0 B (+9.46 KB -69.94 B compressed)
        @ember-data/model/-private +44.87 KB -434.0 B (+9.36 KB -69.94 B compressed)
    @ember-data/store +46.89 KB +4.46 KB (+9.78 KB +735.53 B compressed)
        @ember-data/store/-private +45.89 KB +4.46 KB (+9.57 KB +735.53 B compressed)
    @ember-data/record-data +23.48 KB -711.0 B (+4.9 KB -114.58 B compressed)
        @ember-data/record-data/-private +23.48 KB -711.0 B (+4.9 KB -114.58 B compressed)

Full Asset Analysis (Modern)

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


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

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '46.89 KB' │
│  compressed  │ '9.78 KB'  │
│ % Of Library │   '27.6'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                        | 45.89 KB  | 9.57 KB    | 97.9          | 27.0
	@ember-data/store/index                           | 1022.00 B | 213.13 B   | 2.1           | 0.6

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '45.34 KB' │
│  compressed  │ '9.46 KB'  │
│ % Of Library │   '26.6'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                        | 44.87 KB  | 9.36 KB    | 99.0          | 26.4
	@ember-data/model/index                           | 486.00 B  | 101.35 B   | 1.0           | 0.3

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

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '20.42 KB' │
│  compressed  │ '4.26 KB'  │
│ % Of Library │   '12.0'   │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                       | 7.36 KB   | 1.53 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   | 809.35 B   | 18.6          | 2.2
	@ember-data/serializer/rest                       | 2.87 KB   | 611.86 B   | 14.0          | 1.7
	@ember-data/serializer/index                      | 611.00 B  | 127.41 B   | 2.9           | 0.4
	@ember-data/serializer/transform                  | 215.00 B  | 44.83 B    | 1.0           | 0.1

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '15.93 KB' │
│  compressed  │ '3.32 KB'  │
│ % Of Library │   '9.4'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                          | 7.88 KB   | 1.64 KB    | 49.5          | 4.6
	@ember-data/adapter/-private                      | 3.79 KB   | 808.31 B   | 23.8          | 2.2
	@ember-data/adapter/error                         | 1.82 KB   | 389.14 B   | 11.4          | 1.1
	@ember-data/adapter/index                         | 1.41 KB   | 301.55 B   | 8.9           | 0.8
	@ember-data/adapter/json-api                      | 1.03 KB   | 220.84 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   | 450.24 B   | 24.4          | 1.2
	ember-data/-private                               | 1.75 KB   | 373.08 B   | 20.2          | 1.0
	ember-data/adapters/errors                        | 1.19 KB   | 253.79 B   | 13.7          | 0.7
	ember-data/setup-container                        | 368.00 B  | 76.74 B    | 4.2           | 0.2
	ember-data/relationships                          | 318.00 B  | 66.31 B    | 3.6           | 0.2
	ember-data/serializers/embedded-records-mixin     | 274.00 B  | 57.14 B    | 3.1           | 0.2
	ember-data/serializers/json-api                   | 251.00 B  | 52.34 B    | 2.8           | 0.1
	ember-data/adapters/json-api                      | 245.00 B  | 51.09 B    | 2.8           | 0.1
	ember-data/serializers/json                       | 243.00 B  | 50.67 B    | 2.7           | 0.1
	ember-data/serializers/rest                       | 243.00 B  | 50.67 B    | 2.7           | 0.1
	ember-data/transform                              | 241.00 B  | 50.25 B    | 2.7           | 0.1
	ember-data/adapters/rest                          | 237.00 B  | 49.42 B    | 2.7           | 0.1
	ember-data/serializer                             | 232.00 B  | 48.38 B    | 2.6           | 0.1
	ember-data/adapter                                | 226.00 B  | 47.13 B    | 2.5           | 0.1
	ember-data/model                                  | 222.00 B  | 46.29 B    | 2.5           | 0.1
	ember-data/store                                  | 222.00 B  | 46.29 B    | 2.5           | 0.1
	ember-data/attr                                   | 218.00 B  | 45.46 B    | 2.5           | 0.1
	ember-data/version                                | 161.00 B  | 33.57 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   | 632.71 B   | 44.4          | 1.7
	ember-inflector/lib/system/inflections            | 1.59 KB   | 339.29 B   | 23.8          | 0.9
	ember-inflector/lib/system                        | 471.00 B  | 98.22 B    | 6.9           | 0.3
	ember-inflector/index                             | 379.00 B  | 79.03 B    | 5.6           | 0.2
	ember-inflector/lib/helpers/pluralize             | 369.00 B  | 76.95 B    | 5.4           | 0.2
	ember-inflector/lib/utils/make-helper             | 332.00 B  | 69.23 B    | 4.9           | 0.2
	ember-inflector/lib/system/string                 | 318.00 B  | 66.31 B    | 4.7           | 0.2
	ember-inflector/lib/helpers/singularize           | 296.00 B  | 61.72 B    | 4.3           | 0.2

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.77 KB'  │
│  compressed  │ '590.80 B' │
│ % Of Library │   '1.6'    │
└──────────────┴────────────┘
	Module                                            | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                           | 2.27 KB   | 485.48 B   | 82.2          | 1.3
	@ember-data/debug/setup                           | 505.00 B  | 105.31 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[bot] avatar Aug 13 '22 09:08 github-actions[bot]

Performance Report for 36340c864bb7effdb18abc51418f77f7e86efbd9

Scenario - basic-record-materialization: ☑️ Performance is stable

☑️ duration phase no difference [-64ms to 98ms] ☑️ Phase [navigationStart] => [start-data-generation] phase no difference [-7ms to 9ms] ☑️ Phase [start-data-generation] => [start-push-payload] phase no difference [-14ms to 1ms] ⚠️ Phase [start-push-payload] => [start-peek-records] phase estimated regression +53ms [7ms to 98ms] OR +1.94% [0.26% to 3.56%] ⚠️ Phase [start-peek-records] => [start-record-materialization] phase estimated regression +17ms [14ms to 21ms] OR +21.83% [17.44% to 26.1%] ☑️ Phase [start-record-materialization] => [end-record-materialization] phase no difference [-82ms to 94ms] ☑️ Phase [end-record-materialization] => [Test End] phase no difference [-1ms to 32ms]

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

⚠️ duration phase estimated regression +41ms [17ms to 64ms] OR +3.11% [1.34% to 4.89%] ☑️ Phase [navigationStart] => [start-find-all] phase no difference [-8ms to 10ms] ⚠️ Phase [start-find-all] => [start-materialization] phase estimated regression +15ms [6ms to 24ms] OR +2.84% [1.09% to 4.61%] ☑️ Phase [start-materialization] => [end-materialization] phase no difference [-5ms to 12ms] ⚠️ Phase [end-materialization] => [Test End] phase estimated regression +3ms [2ms to 5ms] OR +8.44% [5.19% to 14.46%]

Scenario - relationship-materialization-complex: ☑️ Performance is stable

☑️ duration phase no difference [-3ms to 145ms] ☑️ Phase [navigationStart] => [start-data-generation] phase no difference [-8ms to 8ms] ☑️ Phase [start-data-generation] => [start-push-payload] phase no difference [-2ms to 5ms] ⚠️ Phase [start-push-payload] => [start-peek-records] phase estimated regression +21ms [1ms to 42ms] OR +1.57% [0.1% to 3.12%] ⚠️ Phase [start-peek-records] => [start-record-materialization] phase estimated regression +13ms [11ms to 15ms] OR +40.68% [35.42% to 46.6%] ✅ Phase [start-record-materialization] => [start-relationship-materialization] phase estimated improvement -27ms [-39ms to -16ms] OR -4.47% [-6.46% to -2.7%] ☑️ Phase [start-relationship-materialization] => [end-relationship-materialization] phase no difference [-1ms to 104ms] ☑️ Phase [end-relationship-materialization] => [Test End] phase no difference [0ms to 17ms]

Scenario - unload: ☑️ Performance is stable

☑️ duration phase no difference [-37ms to 13ms] ☑️ Phase [navigationStart] => [start-push-payload] phase no difference [-11ms to 10ms] ☑️ Phase [start-push-payload] => [start-unload-records] phase no difference [-12ms to 16ms] ✅ Phase [start-unload-records] => [end-unload-records] phase estimated improvement -14ms [-20ms to -9ms] OR -5.09% [-7.03% to -3.39%] ⚠️ Phase [end-unload-records] => [Test End] phase estimated regression +1ms [0ms to 2ms] OR +2.47% [0.58% to 4.33%]

Scenario - unload-all: ✅ Performance improved

✅ duration phase estimated improvement -18060ms [-18217ms to -17878ms] OR -82.24% [-82.95% to -81.41%] ☑️ Phase [navigationStart] => [start-push-payload] phase no difference [-4ms to 21ms] ☑️ Phase [start-push-payload] => [start-materialization] phase no difference [-23ms to 51ms] ✅ Phase [start-materialization] => [start-unload-all] phase estimated improvement -29ms [-48ms to -8ms] OR -3.45% [-5.78% to -0.97%] ✅ Phase [start-unload-all] => [end-unload-all] phase estimated improvement -18053ms [-18180ms to -17927ms] OR -96.67% [-97.35% to -95.99%] ⚠️ Phase [end-unload-all] => [Test End] phase estimated regression +1ms [1ms to 2ms] OR +3.48% [1.6% to 5.41%]

Scenario - destroy: ☑️ Performance is stable

☑️ duration phase no difference [-26ms to 12ms] ☑️ Phase [navigationStart] => [start-push-payload] phase no difference [-11ms to 8ms] ☑️ Phase [start-push-payload] => [start-destroy-records] phase no difference [-5ms to 18ms] ✅ Phase [start-destroy-records] => [end-destroy-records] phase estimated improvement -15ms [-18ms to -11ms] OR -6.2% [-7.57% to -4.65%] ⚠️ Phase [end-destroy-records] => [Test End] phase estimated regression +2ms [1ms to 2ms] OR +4.37% [3.53% to 5.68%]

Scenario - add-children: ⚠️ Performance regressed

⚠️ duration phase estimated regression +41ms [24ms to 58ms] OR +3.79% [2.25% to 5.37%] ☑️ Phase [navigationStart] => [start-push-initial-payload] phase no difference [-5ms to 15ms] ⚠️ Phase [start-push-initial-payload] => [start-push-update-payload] phase estimated regression +11ms [5ms to 17ms] OR +3.77% [1.86% to 5.89%] ⚠️ Phase [start-push-update-payload] => [end-push-update-payload] phase estimated regression +15ms [11ms to 20ms] OR +6.4% [4.7% to 8.16%] ⚠️ Phase [end-push-update-payload] => [Test End] phase estimated regression +11ms [10ms to 12ms] OR +20.4% [18.78% to 21.87%]

Scenario - unused-relationships: ☑️ Performance is stable

☑️ duration phase no difference [-1ms to 33ms] ☑️ Phase [navigationStart] => [start-push-payload] phase no difference [-4ms to 14ms] ☑️ Phase [start-push-payload] => [end-push-payload] phase no difference [-9ms to 11ms] ⚠️ Phase [end-push-payload] => [Test End] phase estimated regression +8ms [7ms to 10ms] OR +16.22% [14.34% to 19.47%]

github-actions[bot] avatar Aug 13 '22 09:08 github-actions[bot]