-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Code cleanup * spelling * codeql format * change conventions * spaces * Add this * events
- Loading branch information
Showing
19 changed files
with
285 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.IO; | ||
|
||
namespace BenchmarkTests; | ||
|
||
public class WriteTest | ||
namespace BenchmarkTests | ||
{ | ||
private RecyclableMemoryStream? subject; | ||
private readonly byte[] bytes = new byte[] { 1, 2, 3, 4, 5, 6 }; | ||
|
||
[IterationSetup] | ||
public void IterationSetup() | ||
public class WriteTest | ||
{ | ||
var manager = new RecyclableMemoryStreamManager(); | ||
this.subject = new RecyclableMemoryStream(manager); | ||
} | ||
private RecyclableMemoryStream? subject; | ||
private readonly byte[] bytes = [1, 2, 3, 4, 5, 6]; | ||
|
||
[Benchmark] | ||
public void WriteByte() | ||
{ | ||
for (int i = 0; i < 10_000_000; i++) | ||
[IterationSetup] | ||
public void IterationSetup() | ||
{ | ||
this.subject!.WriteByte(1); | ||
var manager = new RecyclableMemoryStreamManager(); | ||
this.subject = new RecyclableMemoryStream(manager); | ||
} | ||
} | ||
|
||
[Benchmark] | ||
public void WriteSpan() | ||
{ | ||
for (int i = 0; i < 10_000_000; i++) | ||
[Benchmark] | ||
public void WriteByte() | ||
{ | ||
for (int i = 0; i < 10_000_000; i++) | ||
{ | ||
this.subject!.WriteByte(1); | ||
} | ||
} | ||
|
||
[Benchmark] | ||
public void WriteSpan() | ||
{ | ||
this.subject!.Write(bytes.AsSpan()); | ||
for (int i = 0; i < 10_000_000; i++) | ||
{ | ||
this.subject!.Write(this.bytes.AsSpan()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.