-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Dima Kileyko <[email protected]>
- Loading branch information
1 parent
c6bd076
commit 2c18b25
Showing
9 changed files
with
451 additions
and
265 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
67 changes: 67 additions & 0 deletions
67
src/Menaver.NetBitSet.Tests.Perf/Bitwise/NetBitSetBitwiseShiftOverSmallDataPerfTestSuit.cs
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,67 @@ | ||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Menaver.NetBitSet.Tests.Perf.Bitwise; | ||
|
||
public class NetBitSetBitwiseShiftOverSmallDataPerfTestSuit : PerfTestSuitBase | ||
{ | ||
private const int ShiftCount = 10000000; | ||
|
||
private NetBitSet _netBitSet = null!; | ||
|
||
// 1 byte, 2 bytes, 4 bytes, 8 bytes, 16 bytes | ||
[Params(8, 16, 32, 64, 128)] public ulong BitCount; | ||
|
||
[IterationSetup] | ||
public void Setup() | ||
{ | ||
_netBitSet = BuildRandomNetBitSet(BitCount); | ||
} | ||
|
||
[Benchmark] | ||
public void ShiftLeft() | ||
{ | ||
_netBitSet.ShiftLeft(ShiftCount, Bit.True); | ||
} | ||
|
||
[Benchmark] | ||
public void ShiftRight() | ||
{ | ||
_netBitSet.ShiftRight(ShiftCount, Bit.True); | ||
} | ||
|
||
[Benchmark] | ||
public void ArithmeticShiftLeft() | ||
{ | ||
_netBitSet.ArithmeticShiftLeft(ShiftCount); | ||
} | ||
|
||
[Benchmark] | ||
public void ArithmeticShiftRight() | ||
{ | ||
_netBitSet.ArithmeticShiftRight(ShiftCount); | ||
} | ||
|
||
[Benchmark] | ||
public void LogicalShiftLeft() | ||
{ | ||
_netBitSet.LogicalShiftLeft(ShiftCount); | ||
} | ||
|
||
[Benchmark] | ||
public void LogicalShiftRight() | ||
{ | ||
_netBitSet.LogicalShiftRight(ShiftCount); | ||
} | ||
|
||
[Benchmark] | ||
public void CircularShiftLeft() | ||
{ | ||
_netBitSet.CircularShiftLeft(ShiftCount); | ||
} | ||
|
||
[Benchmark] | ||
public void CircularShiftRight() | ||
{ | ||
_netBitSet.CircularShiftRight(ShiftCount); | ||
} | ||
} |
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.