Skip to content

Commit

Permalink
Use struct instead of class for benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
faustodavid committed Jun 7, 2020
1 parent ee81638 commit aa9c264
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions perf/ListPool.Benchmarks/ListPool.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@
<ProjectReference Include="..\..\src\ListPool\ListPool.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Remove="BenchmarkDotNet.Artifacts\**" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Remove="BenchmarkDotNet.Artifacts\**" />
</ItemGroup>

<ItemGroup>
<None Remove="BenchmarkDotNet.Artifacts\**" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ListPool.Benchmarks.Formatters.Utf8Json
{
public class FakeClass
public struct FakeClass
{
public string Text { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace ListPool.Benchmarks.Formatters.Utf8Json
{
public class FakeClassUsingListPool : IDisposable
public struct FakeClassUsingListPool : IDisposable
{
[JsonFormatter(typeof(StringAsListPoolOfCharsFormatter))]
public ListPool<char> Text { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class StringAsListPoolOfChars_Serialize
{
[Params(100, 1_000, 10_000)] public int N { get; set; }

private readonly FakeClass _fakeClass = new FakeClass();
private readonly FakeClassUsingListPool _fakeClassUsingListPool = new FakeClassUsingListPool();
private FakeClass _fakeClass = new FakeClass();
private FakeClassUsingListPool _fakeClassUsingListPool = new FakeClassUsingListPool();

[GlobalSetup]
public void GlobalSetup()
Expand Down

0 comments on commit aa9c264

Please sign in to comment.