You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+73-17Lines changed: 73 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,7 @@ MessagePack has a compact binary size and a full set of general purpose expressi
34
34
-[Security](#security)
35
35
-[Performance](#performance)
36
36
-[Deserialization Performance for different options](#deserialization-performance-for-different-options)
37
+
-[String interning](#string-interning)
37
38
-[LZ4 Compression](#lz4-compression)
38
39
-[Attributions](#attributions)
39
40
-[Comparison with protobuf, JSON, ZeroFormatter](#comparison-with-protobuf-json-zeroformatter)
@@ -699,7 +700,7 @@ Benchmarks comparing MessagePack For C# to other serializers were run on `Window
699
700
* Avoid string key decoding for lookup maps (string key and use automata based name lookup with inlined IL code generation, see: [AutomataDictionary](https://github.com/neuecc/MessagePack-CSharp/blob/bcedbce3fd98cb294210d6b4a22bdc4c75ccd916/src/MessagePack/Internal/AutomataDictionary.cs)
700
701
* To encode string keys, use pre-generated member name bytes and fixed sized byte array copies in IL, see: [UnsafeMemory.cs](https://github.com/neuecc/MessagePack-CSharp/blob/f17ddc5d107d3a2f66f60398b214ef87919ff892/src/MessagePack/Internal/UnsafeMemory.cs)
701
702
702
-
Before creating this library, I implemented a fast fast serializer with [ZeroFormatter#Performance](https://github.com/neuecc/ZeroFormatter#performance). This is a further evolved implementation. MessagePack for C# is always fast and optimized for all types (primitive, small struct, large object, any collections).
703
+
Before creating this library, I implemented a fast serializer with [ZeroFormatter#Performance](https://github.com/neuecc/ZeroFormatter#performance). This is a further evolved implementation. MessagePack for C# is always fast and optimized for all types (primitive, small struct, large object, any collections).
703
704
704
705
### <aname="deserialize-performance"></a>Deserialization Performance for different options
705
706
@@ -758,6 +759,49 @@ Extra note, this is serialization benchmark result.
758
759
759
760
Of course, `IntKey` is fastest but `StringKey` also performs reasonably well.
If you are writing your own formatter for some type that contains strings,
803
+
you can call on the `StringInterningFormatter` directly from your formatter as well for the strings.
804
+
761
805
## LZ4 Compression
762
806
763
807
MessagePack is a fast and *compact* format but it is not compression. [LZ4](https://github.com/lz4/lz4) is an extremely fast compression algorithm, and using it MessagePack for C# can achieve extremely fast performance as well as extremely compact binary sizes!
@@ -1452,24 +1496,36 @@ var resolver = MessagePack.Resolvers.CompositeResolver.Create(
1452
1496
1453
1497
## Reserved Extension Types
1454
1498
1455
-
MessagePack for C# already used some MessagePack extension type codes, be careful to use same ext code.
1499
+
MessagePack for C# already used some MessagePack extension type codes, be careful to avoid using the same ext code for other purposes.
1500
+
1501
+
Range | Reserved for
1502
+
--|--
1503
+
\[-128, -1\] | Reserved by the msgpack spec for predefined types
1504
+
\[30, 120) | Reserved for this library's use to support common types in .NET
1505
+
1506
+
This leaves the following ranges for your use:
1507
+
1508
+
-\[0, 30)
1509
+
-\[120, 127]
1510
+
1511
+
Within the *reserved* ranges, this library defines or implements extensions that use these type codes:
1456
1512
1457
1513
| Code | Type | Use by |
1458
-
| ---| ---| --- |
1459
-
| -1 | DateTime | MessagePack-spec reserved for timestamp |
1460
-
| 30 | Vector2[]| for Unity, UnsafeBlitFormatter |
1461
-
| 31 | Vector3[]| for Unity, UnsafeBlitFormatter |
1462
-
| 32 | Vector4[]| for Unity, UnsafeBlitFormatter |
1463
-
| 33 | Quaternion[]| for Unity, UnsafeBlitFormatter |
1464
-
| 34 | Color[]| for Unity, UnsafeBlitFormatter |
1465
-
| 35 | Bounds[]| for Unity, UnsafeBlitFormatter |
1466
-
| 36 | Rect[]| for Unity, UnsafeBlitFormatter |
1467
-
| 37 | Int[]| for Unity, UnsafeBlitFormatter |
1468
-
| 38 | Float[]| for Unity, UnsafeBlitFormatter |
1469
-
| 39 | Double[]| for Unity, UnsafeBlitFormatter |
1470
-
| 98 | All | MessagePackCompression.Lz4BlockArray |
1471
-
| 99 | All | MessagePackCompression.Lz4Block |
1472
-
| 100 | object | TypelessFormatter |
1514
+
| ---- | ----| --- |
1515
+
| -1 | DateTime | MessagePack-spec reserved for timestamp |
1516
+
| 30 | Vector2[]| for Unity, UnsafeBlitFormatter |
1517
+
| 31 | Vector3[]| for Unity, UnsafeBlitFormatter |
1518
+
| 32 | Vector4[]| for Unity, UnsafeBlitFormatter |
1519
+
| 33 | Quaternion[]| for Unity, UnsafeBlitFormatter |
1520
+
| 34 | Color[]| for Unity, UnsafeBlitFormatter |
1521
+
| 35 | Bounds[]| for Unity, UnsafeBlitFormatter |
1522
+
| 36 | Rect[]| for Unity, UnsafeBlitFormatter |
1523
+
| 37 | Int[]| for Unity, UnsafeBlitFormatter |
1524
+
| 38 | Float[]| for Unity, UnsafeBlitFormatter |
1525
+
| 39 | Double[]| for Unity, UnsafeBlitFormatter |
1526
+
| 98 | All | MessagePackCompression.Lz4BlockArray |
0 commit comments