Skip to content

Commit 1f4ceaa

Browse files
authored
Merge pull request MessagePack-CSharp#1090 from pCYSl5EDgo/ExperimentalPackageDocumentation
Add descriptions about MessagePack.Experimental.
2 parents 38bc9b4 + d372c7a commit 1f4ceaa

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ MessagePack has a compact binary size and a full set of general purpose expressi
4444
- [Be careful when copying buffers](#be-careful-when-copying-buffers)
4545
- [Choosing compression](#choosing-compression)
4646
- [Extensions](#extensions)
47+
- [Experimental Features](#experimental-features)
4748
- [High-Level API (`MessagePackSerializer`)](#high-level-api-messagepackserializer)
4849
- [Multiple MessagePack structures on a single `Stream`](#multiple-messagepack-structures-on-a-single-stream)
4950
- [Low-Level API (`IMessagePackFormatter<T>`)](#low-level-api-imessagepackformattert)
@@ -983,6 +984,16 @@ You can make your own extension serializers or integrate with frameworks. Let's
983984
* [WebApiContrib.Core.Formatter.MessagePack](https://github.com/WebApiContrib/WebAPIContrib.Core#formatters) - supports ASP.NET Core MVC ([details in blog post](https://www.strathweb.com/2017/06/using-messagepack-with-asp-net-core-mvc/))
984985
* [MessagePack.MediaTypeFormatter](https://github.com/sketch7/MessagePack.MediaTypeFormatter) - MessagePack MediaTypeFormatter
985986

987+
## Experimental Features
988+
989+
MessagePack for C# has experimental features which provides you with very performant formatters. There is an official package.
990+
991+
```ps1
992+
Install-Package MessagePack.Experimental
993+
```
994+
995+
For detailed information, see: [Experimental.md](src/MessagePack.Experimental/Experimental.md)
996+
986997
# API
987998

988999
## High-Level API (`MessagePackSerializer`)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# MessagePack.Experimental
2+
3+
This C# project is the experimental project for the features which are very complex, unstable or unsafe.
4+
5+
- [HardwareIntrinsics](HardwareIntrinsics/HardwareIntrinsics.md)
6+
- [UnsafeUnmanagedStructFormatter](UnsafeUnmanagedStructFormatter/UnsafeUnmanagedStructFormatter.md)
7+
8+
**Caution!**
9+
10+
`MessagePack.Experimental` only targets `.NET Core 3.1` and above.
11+
You can not use this in Unity and .NET Framework.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Abstract
2+
3+
`Hardware Intrinsics` is a feature in order to utilize maximum power of the cpu.
4+
You can serialize/deserialize primitive type array much faster than current implementation!
5+
6+
Supported types
7+
8+
- `sbyte[]`
9+
- `short[]`
10+
- `int[]`
11+
- `bool[]`
12+
- `float[]`
13+
- `double[]`
14+
15+
# Usage
16+
17+
```csharp
18+
var resolver = MessagePack.Resolvers.CompositeResolver.Create(new[] { PrimitiveArrayResolver.Instance, MessagePack.Resolvers.StandardResolver.Instance });
19+
```
20+
21+
# When will this feature become official?
22+
23+
- The MessagePack-CSharp's lowest target framework is greater or equals to `.NET Core 3.1`.
24+
- The current very complex and hard to understand implementation is rewritten.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Abstract
2+
3+
`UnsafeUnmanagedStructFormatter`s (de)serialize the blittable value(s) directly.
4+
They are very performant but unstable against the endian.
5+
6+
You should be careful not to share the encoded byte[] among the different endian environments.
7+
8+
Supported types (T where T : unamanaged)
9+
10+
- `T``UnsafeUnmanagedStructFormatter<T>`
11+
- `T[]``UnsafeUnmanagedStructArrayFormatter<T>`
12+
- `Memory<T>``UnsafeUnmanagedStructMemoryFormatter<T>`
13+
- `ReadOnlyMemory<T>``UnsafeUnmanagedStructReadOnlyMemoryFormatter<T>`
14+
- `ReadOnlySequence<T>``UnsafeUnmanagedStructReadOnlySequenceFormatter<T>`
15+
16+
# Usage
17+
18+
```csharp
19+
var resolver = MessagePack.Resolvers.CompositeResolver.Create(
20+
new[] { new UnsafeUnmanagedStructFormatter<Matrix4x4>(typeCode: 96) },
21+
new[] { MessagePack.Resolvers.StandardResolver.Instance });
22+
```
23+
24+
The constructor takes 1 sbyte value.
25+
The sbyte value is the extension type code embedded in serialized byte sequence.
26+
27+
# When will this feature become official?
28+
29+
- Requests are needed.

0 commit comments

Comments
 (0)