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

[BREAKING BUGFIX] eliminate infrastructure for filter record arrays #6702

Merged
merged 1 commit into from
Nov 9, 2019

Conversation

runspired
Copy link
Contributor

@runspired runspired commented Nov 8, 2019

We deprecated filters ages ago and completed killing them off after 3.4. This is the scheduled removal of some secret notification infra we had left in place to keep them working a tad longer if needed.

⚠️ WARNING

This infrastructure had the unintended bug of making us notify array length and [] over-eagerly.
Due to this, the change MAY break apps that were using observers or computed properties on the length or [] properties of RecordArrays when intending to observe changes to properties on records inside these arrays.

For such cases there is an easy refactor to more standard Ember computed property usage ala allRecords.@each.{aProp,bProp}. This risk may be lower in versions of Ember in which @Tracked is in use.

@github-actions
Copy link

github-actions bot commented Nov 8, 2019

Asset Size Report for 579718f

EmberData shrank by 473.0 B (83.0 B compressed)

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

Changeset


EmberData 177.36 KB -473.0 B (37.29 KB -83.0 B compressed)
    @ember-data/store 84.68 KB -473.0 B (17.8 KB -91.57 B compressed)
        @ember-data/store/-private 83.76 KB -473.0 B (17.61 KB -91.66 B compressed)

Full Asset Analysis

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


Library: EmberData
┌────────────┬─────────────┐
│  (index)   │   Values    │
├────────────┼─────────────┤
│   bytes    │ '177.36 KB' │
│ compressed │ '37.36 KB'  │
│  packages  │     10      │
│  modules   │     49      │
└────────────┴─────────────┘

Package: @ember-data/store
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '84.68 KB' │
│  compressed  │ '17.84 KB' │
│ % Of Library │   '47.7'   │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/store/-private                    | 83.76 KB  | 17.64 KB   | 98.9          | 47.2
	@ember-data/store/index                       | 936.00 B  | 197.15 B   | 1.1           | 0.5

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

Package: @ember-data/serializer
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '19.36 KB' │
│  compressed  │ '4.08 KB'  │
│ % Of Library │   '10.9'   │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/serializer/json                   | 7.10 KB   | 1.50 KB    | 36.7          | 4.0
	@ember-data/serializer/-private               | 5.36 KB   | 1.13 KB    | 27.7          | 3.0
	@ember-data/serializer/json-api               | 3.77 KB   | 813.25 B   | 19.5          | 2.1
	@ember-data/serializer/rest                   | 2.68 KB   | 577.76 B   | 13.8          | 1.5
	@ember-data/serializer/index                  | 243.00 B  | 51.18 B    | 1.2           | 0.1
	@ember-data/serializer/transform              | 215.00 B  | 45.28 B    | 1.1           | 0.1

Package: @ember-data/adapter
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '14.52 KB' │
│  compressed  │ '3.06 KB'  │
│ % Of Library │   '8.2'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/adapter/rest                      | 7.60 KB   | 1.60 KB    | 52.3          | 4.3
	@ember-data/adapter/-private                  | 3.50 KB   | 754.90 B   | 24.1          | 2.0
	@ember-data/adapter/error                     | 1.91 KB   | 412.63 B   | 13.2          | 1.1
	@ember-data/adapter/json-api                  | 830.00 B  | 174.82 B   | 5.6           | 0.5
	@ember-data/adapter/index                     | 719.00 B  | 151.44 B   | 4.8           | 0.4

Package: @ember-data/model
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '12.37 KB' │
│  compressed  │ '2.61 KB'  │
│ % Of Library │   '7.0'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/model/-private                    | 11.90 KB  | 2.51 KB    | 96.2          | 6.7
	@ember-data/model/index                       | 486.00 B  | 102.36 B   | 3.8           | 0.3

Package: ember-data
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '9.79 KB' │
│  compressed  │ '2.06 KB' │
│ % Of Library │   '5.5'   │
└──────────────┴───────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-data/index                              | 2.42 KB   | 522.15 B   | 24.7          | 1.4
	ember-data/-private                           | 2.05 KB   | 442.11 B   | 20.9          | 1.2
	ember-data/adapters/errors                    | 1.19 KB   | 256.34 B   | 12.1          | 0.7
	ember-data/setup-container                    | 503.00 B  | 105.94 B   | 5.0           | 0.3
	ember-data/store                              | 406.00 B  | 85.51 B    | 4.1           | 0.2
	ember-data/relationships                      | 318.00 B  | 66.98 B    | 3.2           | 0.2
	ember-data/serializers/embedded-records-mixin | 274.00 B  | 57.71 B    | 2.7           | 0.2
	ember-data/serializers/json-api               | 251.00 B  | 52.86 B    | 2.5           | 0.1
	ember-data/adapters/json-api                  | 245.00 B  | 51.60 B    | 2.4           | 0.1
	ember-data/serializers/json                   | 243.00 B  | 51.18 B    | 2.4           | 0.1
	ember-data/serializers/rest                   | 243.00 B  | 51.18 B    | 2.4           | 0.1
	ember-data/transform                          | 241.00 B  | 50.76 B    | 2.4           | 0.1
	ember-data/adapters/rest                      | 237.00 B  | 49.92 B    | 2.4           | 0.1
	ember-data/serializer                         | 232.00 B  | 48.86 B    | 2.3           | 0.1
	ember-data/adapter                            | 226.00 B  | 47.60 B    | 2.3           | 0.1
	ember-data/model                              | 222.00 B  | 46.76 B    | 2.2           | 0.1
	ember-data/attr                               | 218.00 B  | 45.91 B    | 2.2           | 0.1
	ember-data/initialize-store-service           | 207.00 B  | 43.60 B    | 2.1           | 0.1
	ember-data/version                            | 162.00 B  | 34.12 B    | 1.6           | 0.1

Package: ember-inflector
┌──────────────┬───────────┐
│   (index)    │  Values   │
├──────────────┼───────────┤
│    bytes     │ '7.90 KB' │
│  compressed  │ '1.66 KB' │
│ % Of Library │   '4.5'   │
└──────────────┴───────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	ember-inflector/lib/system/inflector          | 2.75 KB   | 593.35 B   | 34.8          | 1.6
	ember-inflector/lib/system/inflections        | 1.57 KB   | 339.11 B   | 19.9          | 0.9
	ember-inflector/index                         | 1.12 KB   | 241.80 B   | 14.2          | 0.6
	ember-inflector/lib/ext/string                | 783.00 B  | 164.92 B   | 9.7           | 0.4
	ember-inflector/lib/system                    | 452.00 B  | 95.20 B    | 5.6           | 0.2
	ember-inflector/lib/system/string             | 351.00 B  | 73.93 B    | 4.3           | 0.2
	ember-inflector/lib/helpers/pluralize         | 348.00 B  | 73.30 B    | 4.3           | 0.2
	ember-inflector/lib/utils/make-helper         | 308.00 B  | 64.87 B    | 3.8           | 0.2
	ember-inflector/lib/helpers/singularize       | 271.00 B  | 57.08 B    | 3.4           | 0.1

Package: @ember-data/debug
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '2.68 KB'  │
│  compressed  │ '577.76 B' │
│ % Of Library │   '1.5'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/debug/index                       | 2.19 KB   | 472.66 B   | 81.8          | 1.2
	@ember-data/debug/setup                       | 499.00 B  | 105.10 B   | 18.2          | 0.3

Package: @ember-data/canary-features
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '1.24 KB'  │
│  compressed  │ '266.45 B' │
│ % Of Library │   '0.7'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember-data/canary-features/index             | 927.00 B  | 195.25 B   | 73.3          | 0.5
	@ember-data/canary-features/default-features  | 338.00 B  | 71.19 B    | 26.7          | 0.2

Package: @ember/ordered-set
┌──────────────┬────────────┐
│   (index)    │   Values   │
├──────────────┼────────────┤
│    bytes     │ '1.05 KB'  │
│  compressed  │ '227.06 B' │
│ % Of Library │   '0.6'    │
└──────────────┴────────────┘
	Module                                        | Bytes     | Compressed | % of Package  | % Of Library
	-----------------------------------------------------------------------------------------------------
	@ember/ordered-set/index                      | 1.05 KB   | 227.06 B   | 100.0         | 0.6

@runspired
Copy link
Contributor Author

There are 6 travis failures, all in one module, that are not the usual travis-ci flake. Will investigate.

@runspired
Copy link
Contributor Author

Fixed travis upstream, they had implemented a custom filter that (like the deprecated and removed filter) depended on this infra. They now use computed properties observing peekAll's result with more typical @each chaining

Copy link
Member

@hjdivad hjdivad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although I'd describe the potential breakage a bit differently.

It may have been the mechanism filters were previously implemented with, but at this point we are over-eagerly emitting [] change notifications and that aspect of the cleanup amounts to a bugfix.

@runspired runspired changed the title [CHORE] eliminate infrastructure for filter record arrays [BUGFIX] eliminate infrastructure for filter record arrays Nov 8, 2019
@runspired runspired added 🏷️ bug This PR primarily fixes a reported issue 🏷️ cleanup This PR primarily removes deprecated functionality 🎯 canary PR is targeting canary (default) labels Nov 8, 2019
@runspired runspired changed the title [BUGFIX] eliminate infrastructure for filter record arrays [BREAKING BUGFIX] eliminate infrastructure for filter record arrays Nov 9, 2019
@runspired
Copy link
Contributor Author

While there is some risk to apps that fixing this will cause minor breakages, the fixes to app code when this occurs are simple, and in apps >= ember-source 3.13 there may not even be this risk due to tracked and autotracking.

After considering whether this is a risk we should take, we're going to merge this, as the effort to attempt a deprecation would be large and the refactoring and improvements it hinders are big.

@runspired runspired merged commit 919fb21 into master Nov 9, 2019
@delete-merged-branch delete-merged-branch bot deleted the chore/record-array-manager-perf branch November 9, 2019 02:49
@runspired runspired added the 🌲 Project Trim 🌲 PRs related to https://github.com/emberjs/data/issues/6166 label Nov 11, 2019
@runspired runspired removed the 🎯 canary PR is targeting canary (default) label May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bug This PR primarily fixes a reported issue 🏷️ cleanup This PR primarily removes deprecated functionality 🌲 Project Trim 🌲 PRs related to https://github.com/emberjs/data/issues/6166
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants