-
Notifications
You must be signed in to change notification settings - Fork 138
Open
Labels
API-breakingThis might introduce incompatible API changesThis might introduce incompatible API changesperformanceImproves performance of existing featuresImproves performance of existing features
Milestone
Description
The SerializedValues::with_capacity constructor takes a capacity argument which is supposed to represent the expected total size of the serialized values, but currently we are passing the expected value count, which is guaranteed to be at least 4x too small as each value takes up at least 4 bytes in the serialized form (but usually more, 4 bytes is just for encoding size).
I think we should either:
- Get rid of
with_capacity, or at least stop using it in the driver because the preallocated space will usually be orders of magnitude too small and it doesn't matter, - Add a method to
Valueinterface which returns the expected serialized size, - Extend the
Valueinterface so thatserializecan write to other types thanVec<u8>- this way we could implement aCountingWriterwhich only counts bytes, then we could estimate the serialized size ofValueby serializing theValueusingCountingWriterfirst, which should be a fast operation for most of the types.
If we decide to go with points 2/3, we could implement them together - the method mentioned in 2. would have a default implementation described in 3.
Metadata
Metadata
Assignees
Labels
API-breakingThis might introduce incompatible API changesThis might introduce incompatible API changesperformanceImproves performance of existing featuresImproves performance of existing features