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
Various serialization simplifcations and optimizations #9039
Commits on Nov 7, 2016
-
Remove unused ReadVersion and WriteVersion
CDataStream and CAutoFile had a ReadVersion and WriteVersion method that was never used. Remove them.
1Configuration menu - View commit details
-
Copy full SHA for 50e8a9c - Browse repository at this point
Copy the full SHA 50e8a9cView commit details -
Make streams' read and write return void
The stream implementations had two cascading layers (the upper one with operator<< and operator>>, and a lower one with read and write). The lower layer's functions are never cascaded (nor should they, as they should only be used from the higher layer), so make them return void instead.
Configuration menu - View commit details
-
Copy full SHA for c2c5d42 - Browse repository at this point
Copy the full SHA c2c5d42View commit details -
Make nType and nVersion private and sometimes const
Make the various stream implementations' nType and nVersion private and const (except in CDataStream where we really need a setter).
Configuration menu - View commit details
-
Copy full SHA for fad9b66 - Browse repository at this point
Copy the full SHA fad9b66View commit details -
Make GetSerializeSize a wrapper on top of CSizeComputer
Given that in default GetSerializeSize implementations created by ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid of the specialized GetSerializeSize methods everywhere, and just use CSizeComputer. This removes a lot of code which isn't actually used anywhere. For CCompactSize and CVarInt this actually removes a more efficient size computing algorithm, which is brought back in a later commit.
Configuration menu - View commit details
-
Copy full SHA for 657e05a - Browse repository at this point
Copy the full SHA 657e05aView commit details -
Remove the nType and nVersion as parameters to all serialization methods and functions. There is only one place where it's read and has an impact (in CAddress), and even there it does not impact any of the recursively invoked serializers. Instead, the few places that need nType or nVersion are changed to read it directly from the stream object, through GetType() and GetVersion() methods which are added to all stream classes.
Configuration menu - View commit details
-
Copy full SHA for 5284721 - Browse repository at this point
Copy the full SHA 5284721View commit details -
Configuration menu - View commit details
-
Copy full SHA for a603925 - Browse repository at this point
Copy the full SHA a603925View commit details -
Make CSerAction's ForRead() constexpr
The CSerAction's ForRead() method does not depend on any runtime data, so guarantee that requests to it can be optimized out by making it constexpr. Suggested by Cory Fields.
Configuration menu - View commit details
-
Copy full SHA for a2929a2 - Browse repository at this point
Copy the full SHA a2929a2View commit details -
Add optimized CSizeComputer serializers
To get the advantages of faster GetSerializeSize() implementations back that were removed in "Make GetSerializeSize a wrapper on top of CSizeComputer", reintroduce them in the few places in the form of a specialized Serialize() implementation. This actually gets us in a better state than before, as these even get used when they're invoked indirectly in the serialization of another object.
Configuration menu - View commit details
-
Copy full SHA for 25a211a - Browse repository at this point
Copy the full SHA 25a211aView commit details -
Use fixed preallocation instead of costly GetSerializeSize
Dbwrapper used GetSerializeSize() to compute the size of the buffer to preallocate. For some cases (specifically: CCoins) this requires a costly compression call. Avoid this by just using fixed size preallocations instead.
Configuration menu - View commit details
-
Copy full SHA for d59a518 - Browse repository at this point
Copy the full SHA d59a518View commit details