Skip to content

Releases: jamescourtney/FlatSharp

7.9.0

26 May 08:55
296bb9e

Choose a tag to compare

7.9.0

FlatSharp 7.9.0 is a relatively minor release in the 7.X tree. While work is going (slowly) on FlatSharp 8 as time permits, my intent is for the 7.X line to receive ports for viable changes that would have otherwise been only for FlatSharp 8.

  • The generate methods compiler option now emits operator overloads for value struct equality.
  • Unions and their members now have [FlatBufferMetadata] attributes emitted.
  • Pretty printing is now disabled by default for generated code. This makes the FlatSharp compiler considerably faster at the cost of slightly uglier generated code. This can be re-enabled via a compiler switch.
  • Support for partial properties in tables and reference structs via the fs_partialProperty annotation.
  • Fix a bug in the runtime detection logic in the targets file.

What's Changed

Full Changelog: 7.8.0...7.9.0

7.8.0

14 Nov 18:27
03b052b

Choose a tag to compare

FlatSharp 7.8.0 contains a small number of new features and bugfixes thanks to @sssooonnnggg and @trumully! Thank you for the contributions!

Features

  • Unions can how have manually set discriminator values, ie union MyUnion { str : string = 3, MyTable = 6 }
  • Using the <FlatSharpGenerateMethods>true</FlatSharpGenerateMethods> in your .csproj file now allows generating .ToString() methods on certain FlatSharp objects. More in the future!
  • Builds targeting .NET 9 (no .NET 9 features used yet)

Fixes

  • Fix an issue where \ and " characters were not escaped when present in a FlatBuffer attribute value.

Other Changes

  • Removal of the FlatSharp object pooling experimental feature.

What's Changed

New Contributors

Full Changelog: 7.7.0...7.8.0

7.7.0

03 Jun 08:32
cc0659d

Choose a tag to compare

FlatSharp 7.7.0 is a small feature release. Thanks to @trumully and @parched, unions now have implicit operators for assignment:

SomeUnion union = "hello";

Thanks for the contribution!

Additionally, a bug has been fixed relating to use of the required modifier with various setter options. Previous versions of FlatSharp would generate invalid C# if using required with a non-public setter. The new behavior is to always enforce the concept of required when serializing/parsing, but to only add the C# required keyword to a property when the setter's visibility is public.

What's Changed

New Contributors

Full Changelog: 7.6.0...7.7.0

7.6.0

14 Mar 19:29
2d0766c

Choose a tag to compare

FlatSharp 7.6.0 is a small feature release that adds a couple of quality of life features:

  1. New Match methods on Union types that accept delegates. These aren't the most performant but work well for one-offs or cases where you don't want to implement a Visitor.

  2. Optional support for file visibility on types in FlatSharp-generated code. This reduces the clutter you'll see in your code from FlatSharp. Since file visibility is only supported on C# 11 and above, you will need to opt into this behavior:

         <PropertyGroup>
             <FlatSharpFileVisibility>true</FlatSharpFileVisibility>
         </PropertyGroup>

    From the command line: dotnet FlatSharp.Compiler.dll --file-visibility

In addition to these features, FlatSharp's primary unit tests now all run in NativeAOT mode as well as JIT mode thanks to the new NativeAOT-compatible MSTest runner.

What's Changed

Full Changelog: 7.5.1...7.6.0

7.5.1

25 Feb 11:01
8c8510b

Choose a tag to compare

FlatSharp 7.5.1 is a minor release that contains important fixes for NativeAOT support.

  • Fix .NET 8 Native AOT, Mono AOT, and add CI pipelines to ensure these don't regress again in the future.
  • Remove some methods from IInputBuffer and ISpanWriter that led to the issues with AOT.

What's Changed

Full Changelog: 7.5.0...7.5.1

7.5.0

23 Feb 07:12
c6bf3a6

Choose a tag to compare

FlatSharp 7.5.0 is a medium-sized release with a few changes that may be significant for you. It's now published on Nuget.org. There are no breaking changes.

The primary focus of this release is to significantly reduce the size of the x64 assembly produced by the JITer. There are 3 ways that this is accomplished:

  • String serialization is no longer inlined. This reduces code size substantially but does have a modest impact on serialization speed. There are other changes that offset most of the performance loss. However, FlatSharp should play much more nicely with your instruction cache now.

  • Using ThrowHelper-style methods for throwing exceptions from hot paths.

  • Remove most checked arithmetic. FlatSharp already uses safe methods for interacting with memory. The only checked operations that remain are multiplications and left shifts. This removes many branch instructions and further compacts the generated assembly. If you have a security need to retain checked arithmetic everywhere, please consider compiling with <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> in your csproj.

How much of a difference does this make? Let's look at a contrived example:

table MailingAddress (fs_serializer)
{
    to : string;
    street : string;
    city : string;
    zip_code : int;
}

Examining the bytes of code generated to serialize this results in:

Version Performance Table Serialize Bytes String Serialize Bytes Total
7.4.0 60ns 3888 (inlined) 0 3888
7.5.0 58ns 988 (method calls) 550 1538

This effect will scale for each string property in your schema, so while this example is contrived, the benefit should be large for applications where strings are a common data type.

Note: The focus is on shrinking the size of the code generated by the JIT. The generated C# is largely unchanged.

There are some other changes as well:

  • Add README.md files to the FlatSharp NuGet packages.
  • Add the [DebuggerTypeProxy] attribute to all generated classes. This ensures that much of the internal FlatSharp state is excluded from debugging views and makes the debugging experience more seamless.

What's Changed

Full Changelog: 7.4.0...7.5.0

7.4.0

02 Dec 19:56
383e72a

Choose a tag to compare

FlatSharp 7.4.0 is available on Nuget with a couple of nonbreaking changes:

  • FlatSharp.Runtime supports .NET 8
  • FlatSharp.Compiler now requires any of .NET 8, .NET 7, or .NET 6 to be installed (previously it supported only .NET 6).
  • Fixes a bug where FlatSharp generated invalid code if FlatSharp was declared as a non-top-level namespace, such as Foo.Bar.FlatSharp.

What's Changed

Full Changelog: 7.2.3...7.4.0

7.2.3

11 Aug 19:20
fadac01

Choose a tag to compare

FlatSharp 7.2.3 is a small release that fixes a few issues:

  • FBS validation issues
  • Issue where FBS files couldn't be loaded when on different drives on Windows systems
  • Cleanup of FlatSharp Unit Tests

7.2.0

03 Aug 09:19
2c53aa0

Choose a tag to compare

7.2.0 is a minor feature release that resolves a few bugs and adds a small number of enhancements to the FlatSharp compiler package.

New Compiler Switches

Select Deserializers

You can now select deserializers FlatSharp should generate. This allows some degree of control over code size from FlatSharp:

<PropertyGroup>
  <FlatSharpDeserializers>Lazy;Greedy</FlatSharpDeserializers>
</PropertyGroup>

Using the command line, you can pass --deserializers Progressive;GreedyMutable

Class Definitions Only

In the same vein, FlatSharp can be configured to only emit class definitions. This allows sharing a set of common schemas between projects.

<PropertyGroup>
  <FlatSharpClassDefinitionsOnly>true</FlatSharpClassDefinitionsOnly>
</PropertyGroup>

Using the command line, you can pass --class-definitions-only.

Input Files Only

Normally, FlatSharp will process all FBS files in the recursive graph, including include references that were not explicitly passed to FlatSharp. With this switch, FlatSharp can be configured to only emit output for explicitly-passed input files.

<PropertyGroup>
  <FlatSharpInputFilesOnly>true</FlatSharpInputFilesOnly>
</PropertyGroup>

Using the command line, you can pass --input-files-only.

Other Enhancements

7.2.0 includes a small set of quality-of-life enhancements:

  • The set of command line options is now part of the file hash in the generated file header. This will make FlatSharp regenerate .cs files when the command line options have changed.
  • All generated classes and vectors now have [DebuggerDisplay] attributes to make using the debugger a little less cumbersome.
  • Bug #384 should now be fixed.

7.1.1

18 Mar 17:31
43eaca8

Choose a tag to compare

7.1.1 is a bugfix release to partially address #372. Negative default values should now work correctly.