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

Save bitset as binary data. #236

Closed
wants to merge 1 commit into from
Closed

Conversation

lyager
Copy link

@lyager lyager commented Sep 28, 2015

  • Use a shifting bitmask to serialize bits.
  • Only use bitset type, others are just as slow.

Converting bitsets to strings by using 1's and 0's takes up too much space on large bitsets.

 - Use a shifting bitmask to serialize bits.
 - Only use bitset type, others are just as slow.
@AzothAmmo
Copy link
Contributor

This has the beginnings of a good change though we'll need to make some adjustments before merging something like this. Serializing like this is great for binary archives but wouldn't look good in a text based archive. In other situations like this (see vector for example) we use the BinaryData wrapper to create two versions of the serialization code - one for archives optimized to handle binary chunks, and one for everyone else.

So that would be the first thing that needs to be done.

The second thing is that all of the types need to be the fixed sized variants, especially things that actually go to be serialized (uint8 instead of char for example).

These are pretty minor requirements so if you don't get around to making them yourself, I'll do them when I do the merge. Otherwise it's a good idea!

@AzothAmmo AzothAmmo added this to the v1.2.0 milestone Sep 28, 2015
@lyager
Copy link
Author

lyager commented Sep 29, 2015

Thanks for the constructive feedback.. I agree, and I will try to submit a new patch soon.

AzothAmmo added a commit that referenced this pull request Feb 5, 2016
Integrates the changes proposed by #236

Bitset will now use a chunking method when serializing to BinaryData
capable archives, which should be faster, especially for larger bitsets.

Archives that do not support BinaryData will continue to use the old method.

Also added a larger bitset to the test case
@AzothAmmo
Copy link
Contributor

I've integrated your changes such that archives that support BinaryData will now automatically save using your chunking method. When loading it will always dynamically check the bitset serialization enum type so that this is backwards compatible.

@AzothAmmo AzothAmmo closed this Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants