Closed jamescourtney closed 3 years ago
Dictionary is too slow to be a proper replacement for an array. However, due to the work in #224, it's now possible to collapse these serialization modes.
PropertyCache
, VectorCache
, and VectorCacheMutable
will be removed in FlatSharp 6. They will be replaced with Progressive
and ProgressiveMutable
. ProgressiveMutable
will support write through for structs.
The semantics of Progressive
deserialization are a hybrid of VectorCache
and PropertyCache
.
fs_preallocate
)fs_preallocate
will support values of Always
, Never
, and Default
, with the following semantics:
Always |
Never |
Default |
|
---|---|---|---|
Greedy |
OK | Error | OK |
Progressive |
OK | OK | OK |
Lazy |
Error | OK | OK |
The meaning of Default
can vary contextually.
Greedy
serializer, Default
is equivalent to Always
.Lazy
serializer, Default
is equivalent to Never
.Progressive
serializer, FlatSharp will choose Greedy
if the vector is small (ie, < 1024 items or so), and Lazy
if the vector is large.Example:
table Table (fs_serializer:"Progressive")
{
Vector : [ OtherTable ] (fs_vector:"IIndexedVector", fs_preallocate:"Never");
}
This is done -- need more benchmarking to determine if we should keep the fs_preallocate
attribute or not.
fs_preallocate
removed.
The main difference is preallocation of vectors with vector cache. Can we meet in the middle and use a Dictionary that fills up gradually?