Abort hlsf, goes back to tlsf, may use 'Arena-ed tlsf'
This commit is contained in:
@@ -53,12 +53,12 @@ namespace StgSharp.Benchmark
|
||||
1024,
|
||||
4096
|
||||
];
|
||||
private HybridLayerSegregatedFitAllocator _hlsfAllocator = null!;
|
||||
private readonly int[] _freeOrderByBatch = new int[TotalOperationsPerInvoke];
|
||||
private readonly uint[] _requestSizesByBatch = new uint[TotalOperationsPerInvoke];
|
||||
private readonly List<HlsfHandle> _hlsfLocalList = new();
|
||||
private readonly List<nint> _libcLocalList = new();
|
||||
private readonly uint[] _requestSizesByBatch = new uint[TotalOperationsPerInvoke];
|
||||
private readonly int[] _freeOrderByBatch = new int[TotalOperationsPerInvoke];
|
||||
private Random _random = new(42);
|
||||
private HybridLayerSegregatedFitAllocator _hlsfAllocator = null!;
|
||||
|
||||
[GlobalCleanup]
|
||||
public void Cleanup()
|
||||
@@ -114,6 +114,21 @@ namespace StgSharp.Benchmark
|
||||
return (size + mask) & ~mask;
|
||||
}
|
||||
|
||||
private void BuildIterationWorkload()
|
||||
{
|
||||
for (int batch = 0; batch < BatchCount; batch++)
|
||||
{
|
||||
int batchOffset = batch * AllocationCount;
|
||||
for (int i = 0; i < AllocationCount; i++)
|
||||
{
|
||||
_requestSizesByBatch[batchOffset + i] = AlignSize((uint)AllocSizes[_random.Next(AllocSizes.Length)]);
|
||||
_freeOrderByBatch[batchOffset + i] = i;
|
||||
}
|
||||
|
||||
ShuffleFreeOrder(batchOffset, AllocationCount);
|
||||
}
|
||||
}
|
||||
|
||||
private static nuint GetArenaBytes()
|
||||
{
|
||||
const int defaultMb = 512;
|
||||
@@ -152,7 +167,7 @@ namespace StgSharp.Benchmark
|
||||
}
|
||||
|
||||
private unsafe void RunLibc(
|
||||
int batch
|
||||
int batch
|
||||
)
|
||||
{
|
||||
int batchOffset = batch * AllocationCount;
|
||||
@@ -173,21 +188,6 @@ namespace StgSharp.Benchmark
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildIterationWorkload()
|
||||
{
|
||||
for (int batch = 0; batch < BatchCount; batch++)
|
||||
{
|
||||
int batchOffset = batch * AllocationCount;
|
||||
for (int i = 0; i < AllocationCount; i++)
|
||||
{
|
||||
_requestSizesByBatch[batchOffset + i] = AlignSize((uint)AllocSizes[_random.Next(AllocSizes.Length)]);
|
||||
_freeOrderByBatch[batchOffset + i] = i;
|
||||
}
|
||||
|
||||
ShuffleFreeOrder(batchOffset, AllocationCount);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShuffleFreeOrder(
|
||||
int offset,
|
||||
int count
|
||||
|
||||
Reference in New Issue
Block a user