Skip to content

v4.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 04 Dec 09:56
df74860

MasterMemory 4.0.0 is now available on NuGet. It is built on MessagePack for C# v4, which was released today.

The database binary format is unchanged: v4 reads a database built by v3. The basic API is kept, with some breaking changes. See the README for everything v4 does, and v3 -> v4 migration for what changed and how to fix it.

What's new

  • Compatible with trimming and Native AOT, and no serializer setup is needed for IL2CPP.
  • MemoryDatabaseOptions holds string interning, the formatter factory and compression in one reusable object.
  • LZ4 is opt-in through MessagePack.LZ4. Nothing is compressed by default.
  • Lookups and table construction are faster.
  • RangeView<T> has AsSpan() and an allocation-free foreach. Its reverse is ReverseRangeView<T>.
  • A composite key is passed member by member, and its leading part can be queried on its own (FindByGender for a (Gender, Age) key).
  • ImmutableBuilder is merged into DatabaseBuilder (ToDatabaseBuilder, AddOrReplace, ToMemoryDatabase).
  • MemoryDatabase reads from byte[], ReadOnlyMemory<byte> and ReadOnlySpan<byte>.
  • Keys can be declared in a base class, in another part of a partial class, or on a positional record parameter.
  • Invalid table definitions are reported as errors (MAM004 to MAM011) instead of generating nothing.

Fixed issues

  • #99: a database over 1 GB can be built, and one over 2 GB is refused with a clear error.
  • #102: enum keys are compared by their underlying value, without boxing.
  • #108: tables with the same class name in different namespaces are reported as error MAM004.
  • #109: generated code uses fully qualified type names, so using directives inside #if work.
  • #115: the generated MemoryDatabase is now partial, so queries across tables can be added to it.

Verified on

.NET 9, .NET 8 (netstandard2.1), .NET Framework 4.8 (netstandard2.0), Native AOT, and Unity 2022.3.12f1 (editor and IL2CPP).