FlatSharp v4.0.0 Release NotesRelease Date: 2020-10-07 // almost 2 years ago
🔖 Version 4 is a significant milestone for FlatSharp, and represents the culmination of a lot of work. Hope you enjoy it, to the extent that it's possible to enjoy a serialization library!
Glad you asked!
- 👌 Support for optional/nullable scalars (tables only) (google/flatbuffers#6014)
- 👌 Support for "indexed vectors", which are Vectors that look and act like Dictionaries. Under the hood, these are sorted vectors that expose a simpler programming model, so it's no longer necessary to worry about whether a vector is sorted or not. Check out the indexed vectors sample!
- 👍 Shared strings are now supported in sorted vectors
- 🆕 New method of publishing benchmark data, benchmarks extended to include .NET 5.0
🐎 Lots of work went into optimizing how the CLR JIT treats FlatSharp's code. Performance is increased anywhere from 10 - 30% relative to version 3.3.1.
- Much of this improvement was changes to allow the JIT to elide virtual function calls when invoking methods on SpanReader and InputBuffer. More background is available here: dotnet/runtime#32815
- Other changes involved removing some unnecessary branches and function calls on hot paths
🔌 FlatSharp's backend was completely rewritten to be more modular, so that future types can be supported more easily. It is now possible (though not advised) to write your own plugins. This amounted to a rewrite of a large part of the code.
💥 Breaking Changes
FlatSharp adheres to semantic versioning, and there are breaking public API changes in version 4:
SpanWriterhas been changed from a
struct. It is no longer inheritable. A new
ISpanWriterinterface has been introduced should you wish to provide your own.
UnsafeSpanWriterremains a class, but is sealed.
- 🚚 The base class
InputBufferhas been removed. It has been replaced with
ReadOnlyMemoryInputBuffer, and the unsafe variants remain the same.
- 👌 Support for memory vectors has been dropped for all types but
byte. This was to address a design oversight where precompiled serializers would produce incorrect results when running on big-endian platforms.