Skip to content

Commit

Permalink
Cleaned up some code.
Browse files Browse the repository at this point in the history
  • Loading branch information
MeltyPlayer committed May 18, 2024
1 parent 66a28c7 commit 12de9b9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Schema/src/testing/SchemaMemoryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public long Position {
public void Write(ReadOnlySpan<byte> src) => impl.Write(src);

public void Write(IReadableStream readableStream)
=> impl.WriteImpl(readableStream);
=> readableStream.CopyTo(impl);

public Endianness Endianness => EndiannessUtil.SystemEndianness;
}
Expand Down
32 changes: 0 additions & 32 deletions Schema/src/util/streams/BaseStreamImpls.cs

This file was deleted.

10 changes: 1 addition & 9 deletions Schema/src/util/streams/WritableStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@

namespace schema.util.streams {
public class WritableStream(Stream impl) : ISeekableWritableStream {
/// <summary>
/// (Straight-up copied from the implementation of Stream.CopyTo())
/// We pick a value that is the largest multiple of 4096 that is still smaller than the large object heap threshold (85K).
/// The CopyTo/CopyToAsync buffer is short-lived and is likely to be collected at Gen0, and it offers a significant
/// improvement in Copy performance.
/// </summary>
private const int DEFAULT_COPY_BUFFER_SIZE = 81920;

public static implicit operator WritableStream(Stream impl) => new(impl);

internal Stream Impl => impl;
Expand All @@ -39,6 +31,6 @@ public long Length {

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Write(IReadableStream readableStream)
=> impl.WriteImpl(readableStream);
=> readableStream.CopyTo(impl);
}
}

0 comments on commit 12de9b9

Please sign in to comment.