-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#nullable disable | ||
|
||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Order; | ||
|
||
// | Method | Mean | Error | StdDev | Rank | Allocated | | ||
// |----------- |----------:|----------:|----------:|-----:|----------:| | ||
// | UnsafeAERC | 1.153 ns | 0.0035 ns | 0.0033 ns | 1 | - | | ||
// | SafeAERC | 18.992 ns | 0.0751 ns | 0.0665 ns | 2 | - | | ||
|
||
namespace Entitas.Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
[Orderer(SummaryOrderPolicy.FastestToSlowest)] | ||
[RankColumn] | ||
public class AERCBenchmarks | ||
{ | ||
SafeAERC _safeAerc; | ||
UnsafeAERC _unsafeAerc; | ||
|
||
[GlobalSetup] | ||
public void GlobalSetup() | ||
{ | ||
_safeAerc = new SafeAERC(null); | ||
_unsafeAerc = new UnsafeAERC(); | ||
} | ||
|
||
[Benchmark] | ||
public void SafeAERC() | ||
{ | ||
_safeAerc.Retain(this); | ||
_safeAerc.Release(this); | ||
} | ||
|
||
[Benchmark] | ||
public void UnsafeAERC() | ||
{ | ||
_unsafeAerc.Retain(this); | ||
_unsafeAerc.Release(this); | ||
} | ||
} | ||
} |
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