提交 6f1baf8b 编写于 作者: C CyrusNajmabadi

Write out less data for objects.

上级 4644b5bf
......@@ -32,7 +32,7 @@ internal sealed partial class ObjectReader : IDisposable
/// this version, just change VersionByte2.
/// </summary>
internal const byte VersionByte1 = 0b10101010;
internal const byte VersionByte2 = 0b00000111;
internal const byte VersionByte2 = 0b00001000;
private readonly BinaryReader _reader;
private readonly CancellationToken _cancellationToken;
......@@ -580,7 +580,6 @@ private object ReadObject()
{
var id = _objectReferenceMap.GetNextReferenceId();
_reader.ReadByte();
var typeReader = _binderSnapshot.GetTypeReaderFromId(this.ReadInt32());
// recursive: read and construct instance immediately from member elements encoding next in the stream
......
......@@ -751,7 +751,10 @@ private void WriteObjectWorker(IObjectWritable writable)
_objectReferenceMap.Add(writable);
_writer.Write((byte)EncodingKind.Object);
this.WriteKnownType(writable.GetType());
// Directly write out the type-id for this object. i.e. no need to write out the 'Type'
// tag since we just wrote out the 'Object' tag
this.WriteInt32(_binderSnapshot.GetTypeId(writable.GetType()));
writable.WriteTo(this);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册