## Added Feature Adds a single threaded array pool that works exactly the same as `ArrayPool<T>.Shared`. The `STArrayPool<T>.Shared` can only be used on a single thread, the main game thread of the server. Note: Unlike the built-in array pool, there is no hook into the _GC Gen 2_. This means to relieve potentially high memory pressure, `ArrayPool<T>.Shared.Trim()` must be called. The pool will only release arrays _after two successive calls within 10 seconds or longer_. If the server is at less than 70% total memory usage, or the server is not going to use this pool for something egregious, then don't bother ever calling Trim(). ## Changes - [X] Fixes ArrayPool calls that should be cleared due to references. - [X] Benchmarks against ArrayPool with 4+ rented arrays deep of the same length. - [x] Unit tests
34 lines
1.7 KiB
C#
34 lines
1.7 KiB
C#
using BenchmarkDotNet.Running;
|
|
using Benchmarks.EntitiesSelectors;
|
|
using Benchmarks.ItemSelectors;
|
|
using Benchmarks.MobileSelectors;
|
|
using Benchmarks.MultiSelectors;
|
|
using Benchmarks.MultiTilesSelectors;
|
|
|
|
namespace Benchmarks
|
|
{
|
|
public static class Program
|
|
{
|
|
private static void Main(string[] args)
|
|
{
|
|
// var featureFlags = BenchmarkRunner.Run<BenchmarkFeatureFlags>();
|
|
// var packetConstruction = BenchmarkRunner.Run<BenchmarkPacketConstruction>();
|
|
// var broadcast = BenchmarkRunner.Run<BenchmarkPacketBroadcast>();
|
|
// var stringHelpers = BenchmarkRunner.Run<BenchmarkStringHelpers>();
|
|
// var indexList = BenchmarkRunner.Run<BenchmarkOrderedHashSet>();
|
|
// var textEncoding = BenchmarkRunner.Run<BenchmarkTextEncoding>();
|
|
// var logging = BenchmarkRunner.Run<BenchmarkConsoleLogging>();
|
|
// var gumpPacket = BenchmarkRunner.Run<OutgoingGumpPacketBenchmarks>();
|
|
// var rngTest = BenchmarkRunner.Run<BenchmarkXoshiro>();
|
|
//var doubleRngText = BenchmarkRunner.Run<BenchmarkDoubleVsFixed>();
|
|
|
|
//var mapEntitiesSelectors = BenchmarkRunner.Run<MapEntitiesSelectors>();
|
|
//var mapMobilesSelectors = BenchmarkRunner.Run<MapMobileSelectors>();
|
|
//var mapMultiTilesSelectors = BenchmarkRunner.Run<MapMultiTilesSelectors>();
|
|
//var mapMultiSelectors = BenchmarkRunner.Run<MapMultiSelectors>();
|
|
// var mapItemsSelectors = BenchmarkRunner.Run<MapItemSelectors>();
|
|
// var stArray = BenchmarkRunner.Run<BenchmarkSTArray>();
|
|
var pooledRefQueue = BenchmarkRunner.Run<BenchmarkPooledRefQueue>();
|
|
}
|
|
}
|
|
}
|