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

Referencing Binary Format: Remove references to collections #230

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wjnicholson
Copy link
Collaborator

@wjnicholson wjnicholson commented Oct 20, 2020

Currently BeanReferences increments counts for values that are collection types, when we never serialize references for collections.
Doesn't affect serialization massively, but without we could be using a smaller references array / more efficient reference numbers. e.g in the test example, previously the letters "A" and "B" used references 5 and 6, rather than the 1 and 2 that they should have been (as the most common item to be referenced).

Can't really change the code to reuse collections, as some types of collections are a bit hairy, what if it's first read as Set but later we serialize a SortedSet with the same elements? Can't reuse the original value but instead need a copy constructor, and that's a lot of effort to code.
If somebody really wanted that effect they could wrap the collection in an ImmutableBean and get the deduplication for free.

Types with collections are a bit hairy, what if it's first read as Set but later we serialize the same thing as SortedSet? Can't reuse the original value but instead need a copy constructor, and that's a lot of effort to code
@wjnicholson wjnicholson changed the title Referencing Binary Format: Remove incrementing references for collections that won't be serialized. Referencing Binary Format: Remove references to collections Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants