Skip to content

Full feature list & planned features

Rikimaru edited this page Jan 7, 2019 · 28 revisions

Features

Major Features

  • Very fast, very small binary output
  • Full support for circular references (including object caching)
  • Full support for polymorphism / inheritance / interfaces
  • Can serialize objects into parts as "ExtenalObjects" (very useful for usage with databases)

Other Features

  • Can serialize Fields and Properties (Check out the Tutorial to see all the different configuration options)
    • ShouldSerialize Callback > Member-Attribute > Class-Attribute > Global Default
  • No need to place attributes on members
    • Serialization is completely "stable", since members are sorted by more than just field-name, type-name, ...
  • Efficient:
    • By default no versioning-, type- or other meta-data is written, only what is strictly needed.
    • Utilizes both VarInt & Zig-Zag encoding (example: values up to 128 only take 1 byte instead of 4...)
    • Encodes type-information in 0 or 1 byte in most cases
    • If the type already matches no types are written at all (vast majority of cases)
    • KnownTypes are encoded as 1 byte
    • Ceras dynamically learns new/unknown types while serializing. New types are written once in compressed form, thus automatically becoming a known type.
    • No slowdown through type lookups! (except for polymorphic types of course)
  • Can serialize in parts. You want to save your Monster, Spell, and Player objects each into their own file, but they all reference each other in many ways? No problem at all! Ceras can automatically split and reassemble entire object-graphs for you. And it's pretty easy: see IExternalRootObject
  • No allocations
    • Generates no "garbage" (garbage-collector pressure) by recycling all internal objects.
    • Integrates with user object-pools as well with ObjectFactory and DiscardObject methods. Especially useful for use as a network protocol or in games so Ceras will not allocate new user-objects and instead get them from your pools.
    • Recycles serialization buffers (just pass in the buffer by ref)
  • Can overwrite objects you already have (by using the Deserialize(ref existingObject) method). Works even when an object already contains references to wrong types, Ceras will optionally use your DiscardObject-Method then. (can be used to eliminate allocations/GC pressure).
  • Advanced caching settings to remember objects and typing information over multiple serialization calls to save even more space
  • Can be used as an extremely efficient binary network protocol
  • Can generate a checksum of all types, fields, attributes, ... which can be used to ensure binary compatability (very useful for networking where you want to check if the server/client are using the same protocol...)
  • Very easy to add new "Formatters" (the things that the serializer uses to actually read/write an object)
  • Various Attributes like [Config], [Ignore], [Include]
  • Version tolerance. Supports all changes: adding new / renaming / reordering / deleting members.
  • Ceras can handle readonly fields in various ways. Ceras can change the contents of objects in readonly fields without having to change the reference in the field itself (aka 'populate' with data). Or it can force-overwrite readonly fields if you really want to (using reflection).
  • Good exceptions: All exceptions Ceras throws contain reasons why something went wrong and what to do about it.
  • Ceras is fully "reentrant" meaning that the same serializer-instance can start a new nested serialization while the other one is still in progress. Very useful when dealing with IExternalRootObjects (simplifies your code a lot).
  • Support for readonly fields: Just set ReadonlyFieldHandling.Members and Ceras will populate the contents of objects in readonly fields. Or set ReadonlyFieldHandling.ForcedOverwrite to overwrite readonly field itself as well (using reflection). (Default is Off because readonly fields are very rarely serialized)

Built-in types

Built-in support for many commonly used .NET types:

  • Primitives(int, string, ...), Enum
  • All ICollection<> so List<>, Dictionary<,>, ...
  • Pretty much all commonly used BCL types: decimal, DateTime, TimeSpan, DateTimeOffset, Guid, Array[], KeyValuePair<,>, Nullable<>, BitVector32, BigInteger

Automatically generates optimized formatters for your types! No attributes or anything needed, everything fully automatic.

  • Some common type missing? Report it and I'll most likely add a formatter for it
  • Planned: Will include an (optional!) set of formatters for Unity3D objects

Planned features

  • Some sort of log that tells you exactly what members are included in the serialization and why, and why the excluded ones are excluded, and what Ceras has tried to determine inclusion/exclusion. Maybe something like ceras.GetMemberInclusionLog(typeof(MyType));
  • "Serialization Constructors" for immutable collections (also supporting private static methods for construction)
  • Performance comparisons beyond simple micro benchmarks
  • Better exceptions (actual exception types instead of the generic Exception)
  • Wider range of unit tests instead of manual test cases / debug asserts
  • Use FastExpressionCompiler when all its bugs are fixed
  • Optional set of formatters for Unity3D
  • Override formatter per-member (aka [Formatter(...)] attribute)
  • Built-in LZ4 and GZip(Zlib) support, including support for Sync-Flush (especially useful for networking scenarios)

Done

  • Handling for readonly fields
  • .NET standard build target
  • Making Ceras available as a nuget package
  • Automatic release builds
  • Automatic version tolerance can now be enabled through config. config.VersionTolerance = VersionTolerance.AutomaticEmbedded;. More options will follow in the future including manual version tolerance if you want to go the extra mile to optimize your code.
  • Ceras supports fields and properties now, checkout the tutorial.cs file to see all the ways to configure what gets serialized
Clone this wiki locally