#894 Enable TaggedFieldSerializer to skip null fields (only works wit… #896
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In my scenario, we have some really big classes with nearly a thousand fields, but each time we would probably just read 20~30 fields, based on our purposes.
So serializing and deserializing the whole entity with chunked encoding could be a serious waste from the performance perspective.
(Well, things are like this because those entities are really basic in our business, e.g video entity for Youtube; and their fields are managed by metadata systems, so they grow big really fast. But different fields are used by different businesses, and most like only a few fields at a time.)
I have done some tests, both the time consuming and the packet size are both considerably smaller then not skipping null fields. (and actually even for entities which are not so big ,the effect is quite obvious as well ,as long as there are null fields). I could share those test results if necessary. And I am not sure if I should add test cases as well for the new feature.
My solution is to filter the cached fields when trying to write the objects, and to do absolutely nothing when reading them.
I am not quite sure if it's a common case, if it's done in a proper way, or in a correct form (it's my very first PR on github).
So just please take a look. Thanks.