Implement L4 Swiss map and benchmarks

This commit is contained in:
Youmu Liu
2026-10-10 17:55:42 +08:00
parent 172f64c6f9
commit 0cef5aa517
10 changed files with 709 additions and 126 deletions
@@ -27,6 +27,8 @@ namespace Nitload.Common.HighPerformance.Memory
internal const uint MaxBufferSize = 0xFFFFFFFF - 64U;
[FieldOffset(16)] internal AllocationState State;
public static uint SizeOf { get; } = (uint)Unsafe.SizeOf<CacheLineMetadata>();
#region tlsf linked list
@@ -43,20 +45,27 @@ namespace Nitload.Common.HighPerformance.Memory
[FieldOffset(8)] public uint PositionMask;
[FieldOffset(12)] public uint SizeMask;
#endregion
[FieldOffset(16)] internal AllocationState State;
#endregion
}
#pragma warning disable IDE0032
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct Handle : IDisposable
public unsafe struct Handle : IDisposable
{
[FieldOffset(0)] private nuint _handle;
[FieldOffset(8)] private nuint _reserved;
internal Handle(
nuint handle,
nuint reserved
)
{
_handle = handle;
_reserved = reserved;
}
[Obsolete("You should not create a CacheLineHandle instance outside a L4", true)]
public Handle() { }