move random gen to Math, working on VL4
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="HlsfStressTest"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.HighPerformance.Memory;
|
||||
using StgSharp.Mathematics.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -45,8 +45,36 @@ namespace StgSharp
|
||||
3UL * 1024UL * 1024UL * 1024UL; // lower default to 512MB
|
||||
|
||||
private static readonly uint[] SizeSweep = {
|
||||
64, 128, 192, 256, 512, 768, 1024, 2048, 3072, 4096, 8192, 12288, 16384, 32768, 49152, 65536, 131072, 196608, 262144, 524288, 786432, 1_048_576, 2_097_152, 3_145_728, 4_194_304, 8_388_608, 12_582_912, 16_777_216, 25_165_824, 33_554_432
|
||||
};
|
||||
64,
|
||||
128,
|
||||
192,
|
||||
256,
|
||||
512,
|
||||
768,
|
||||
1024,
|
||||
2048,
|
||||
3072,
|
||||
4096,
|
||||
8192,
|
||||
12288,
|
||||
16384,
|
||||
32768,
|
||||
49152,
|
||||
65536,
|
||||
131072,
|
||||
196608,
|
||||
262144,
|
||||
524288,
|
||||
786432,
|
||||
1_048_576,
|
||||
2_097_152,
|
||||
3_145_728,
|
||||
4_194_304,
|
||||
8_388_608,
|
||||
12_582_912,
|
||||
16_777_216,
|
||||
25_165_824,
|
||||
33_554_432 };
|
||||
|
||||
public static unsafe void Run()
|
||||
{
|
||||
@@ -116,10 +144,7 @@ namespace StgSharp
|
||||
Console.WriteLine("=== Benchmark Complete ===");
|
||||
}
|
||||
|
||||
private static void BenchAllocFreePairs(
|
||||
HybridLayerSegregatedFitAllocator allocator,
|
||||
int pairs,
|
||||
uint blockSize)
|
||||
private static void BenchAllocFreePairs(HybridLayerSegregatedFitAllocator allocator, int pairs, uint blockSize)
|
||||
{
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
for (int i = 0; i < pairs; i++)
|
||||
@@ -176,9 +201,7 @@ namespace StgSharp
|
||||
Console.WriteLine($" size={Fmt(blockSize),-12} ops={ops,-12} alloc/s={allocOpsPerSec,-16:0.0} touch={touch,-5}");
|
||||
}
|
||||
|
||||
private static void BenchFragmentationCycle(
|
||||
HybridLayerSegregatedFitAllocator allocator,
|
||||
int targetMiB)
|
||||
private static void BenchFragmentationCycle(HybridLayerSegregatedFitAllocator allocator, int targetMiB)
|
||||
{
|
||||
int targetBytes = targetMiB * 1024 * 1024;
|
||||
Random rng = new Random(123);
|
||||
@@ -229,10 +252,7 @@ namespace StgSharp
|
||||
Console.WriteLine($" cleanup freed {live.Count} in {swD.Elapsed.TotalSeconds:0.00}s");
|
||||
}
|
||||
|
||||
private static void BenchFreeThroughput(
|
||||
HybridLayerSegregatedFitAllocator allocator,
|
||||
int count,
|
||||
uint blockSize)
|
||||
private static void BenchFreeThroughput(HybridLayerSegregatedFitAllocator allocator, int count, uint blockSize)
|
||||
{
|
||||
List<HybridLayerSegregatedFitAllocationHandle> list = new List<HybridLayerSegregatedFitAllocationHandle>(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
||||
Reference in New Issue
Block a user