Upgrade to .NET 10 and refactor core components

Upgraded target framework to .NET 10 across all projects to leverage new features and improve performance.

Refactored `JobScheduler` to fix method naming inconsistencies and ensure proper resource disposal. Enhanced `AllocationManager` with safer memory operations and better performance handling. Simplified `ReadOnlyUnsafeCollection` enumerator logic for efficiency.

Overhauled `UnsafeBitSet` with new properties, improved bitwise operations, and optimized memory management. Updated `UnsafeSlotMap` and `ConcurrentSlotMap` for better validation and naming consistency.

Revised `MemoryLeakException` to use `ReadOnlySpan` for improved performance. Simplified `MathematicsBenchmark` logic and integrated `BenchmarkDotNet` for testing.

Added AOT compatibility settings for `Debug` and `Release` configurations. Introduced unit tests for `UnsafeBitSet` to validate functionality. Cleaned up unused code, improved readability, and ensured consistent naming conventions.

Updated project references and metadata for consistency. Enabled inline methods for `NET10_0_OR_GREATER` in `VectorGenerator`.
This commit is contained in:
2025-11-14 11:14:09 +09:00
parent bf4dd5670e
commit 24a7d49ae2
18 changed files with 223 additions and 260 deletions

View File

@@ -10,12 +10,21 @@ namespace Misaki.HighPerformance.LowLevel;
/// <param name="Infos">An array of AllocationInfo containing details about the memory leaks.</param>
public class MemoryLeakException : Exception
{
private readonly IEnumerable<AllocationInfo>? _infos;
private readonly string _message = string.Empty;
private readonly string _message;
public MemoryLeakException(IEnumerable<AllocationInfo> infos)
public override string Message => _message;
public MemoryLeakException(ReadOnlySpan<AllocationInfo> infos)
{
_infos = infos;
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"Found {infos.Length} memory lakes!");
foreach (var info in infos)
{
stringBuilder.AppendLine(GetMessage(info.StackTrace));
}
_message = stringBuilder.ToString();
}
public MemoryLeakException(string message)
@@ -44,25 +53,4 @@ public class MemoryLeakException : Exception
return stringBuilder.ToString();
}
public override string Message
{
get
{
if (_infos == null)
{
return _message;
}
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"Found {_infos.Count()} memory lakes!");
foreach (var info in _infos)
{
stringBuilder.AppendLine(GetMessage(info.StackTrace));
}
return stringBuilder.ToString();
}
}
}