docs(NetworkWriter): doc comments for WriteBlittable (with benchmark) (#2459)

* docs(NetworkWriter): doc comments for WriteBlittable

* Update Assets/Mirror/Runtime/NetworkWriter.cs
This commit is contained in:
James Frowen 2020-11-23 02:32:19 +00:00 committed by GitHub
parent 96a03a3d59
commit 800a3d934b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,8 +140,6 @@ public ArraySegment<byte> ToArraySegment()
}
// WriteBlittable<T> from DOTSNET.
// this is extremely fast, but only works for blittable types.
//
// Benchmark:
// WriteQuaternion x 100k, Macbook Pro 2015 @ 2.2Ghz, Unity 2018 LTS (debug mode)
//
@ -160,11 +158,24 @@ public ArraySegment<byte> ToArraySegment()
//
// * without IsBlittable check
// => 6x faster!
//
// Note:
// WriteBlittable assumes same endianness for server & client.
// All Unity 2018+ platforms are little endian.
// => run NetworkWriterTests.BlittableOnThisPlatform() to verify!
/// <summary>
/// Copies blittable type to buffer
/// <para>
/// This is extremely fast, but only works for blittable types.
/// </para>
/// <para>
/// Note:
/// WriteBlittable assumes same endianness for server and client.
/// All Unity 2018+ platforms are little endian.<br/>
/// => run NetworkWriterTests.BlittableOnThisPlatform() to verify!
/// </para>
/// </summary>
/// <remarks>
/// See <see href="https://docs.microsoft.com/en-us/dotnet/framework/interop/blittable-and-non-blittable-types">Blittable and Non-Blittable Types</see>
/// for more info.
/// </remarks>
/// <typeparam name="T">Needs to be unmanaged, see <see href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/unmanaged-types">unmanaged types</see></typeparam>
/// <param name="value"></param>
public unsafe void WriteBlittable<T>(T value)
where T : unmanaged
{