mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-10-25 20:02:27 +00:00
34 lines
768 B
C#
34 lines
768 B
C#
namespace EightBit.Benchmark
|
|
{
|
|
using BenchmarkDotNet.Attributes;
|
|
|
|
public class BenchmarkBus
|
|
{
|
|
private readonly SealedBus _contents = new();
|
|
|
|
[GlobalSetup]
|
|
public void GlobalSetup()
|
|
{
|
|
for (ushort i = 0; i < ushort.MaxValue; ++i)
|
|
{
|
|
this._contents.Poke(i, (byte)(i % 256));
|
|
}
|
|
this._contents.Address.Joined = 0;
|
|
this._contents.Data = 123;
|
|
}
|
|
|
|
[Benchmark]
|
|
public long Reading()
|
|
{
|
|
this._contents.Read();
|
|
return this._contents.Data;
|
|
}
|
|
|
|
[Benchmark]
|
|
public long Writing()
|
|
{
|
|
this._contents.Write();
|
|
return this._contents.Data;
|
|
}
|
|
}
|
|
} |