Commit Graph

167 Commits

Author SHA1 Message Date
8f4a2aa5d6 Update DebugSymbols 2025-11-27 15:03:05 +09:00
b71ab18050 Update DebugSymbols 2025-11-27 15:02:33 +09:00
b67569aa14 Improve AsSpan, CopyTo, and CopyFrom for IUnsafeCollection 2025-11-27 14:04:46 +09:00
f4e803e5a4 Updated package version 2025-11-25 14:25:48 +09:00
4bcd300a1c Merge pull request 'develop' (#5) from develop into main
Reviewed-on: #5
2025-11-25 03:32:41 +00:00
459f4ba9ee Merge branch 'develop' of https://git.personalnas.com/Misaki/Misaki.HighPerformance into develop
Some checks failed
Publish NuGet Packages / publish (pull_request) Failing after 2m14s
# Conflicts:
#	Misaki.HighPerformance.LowLevel/Collections/UnsafeBitSet.cs
#	Misaki.HighPerformance.Test/UnitTest/Collections/TestUnsafeBitSet.cs
2025-11-25 12:31:16 +09:00
3269244ab1 Refactor memory management with MemoryHandle
Replaced `SafeHandle` with a new `MemoryHandle` system for improved memory tracking, safety, and leak detection. Updated allocators (`ArenaAllocator`, `HeapAllocator`, `StackAllocator`) and collections (`UnTypedArray`, `UnsafeArray<T>`, `UnsafeBitSet`) to use `MemoryHandle`.

Refactored `AllocationManager` to use `ConcurrentSlotMap` for live allocation tracking and added methods for managing `MemoryHandle` instances. Simplified alignment and padding logic across allocators and collections.

Enhanced performance with optimized memory operations (`MemClear`, `MemSet`, `MemCpy`) and vectorized operations in `MemoryUtility` and `UnsafeBitSet`. Fixed alignment issues in vectorized memory operations.

Updated tests to reflect the new memory management system and added new tests for `UnsafeBitSet` bitwise operations. Enabled `ENABLE_COLLECTION_CHECKS` for debug builds and improved error messages and documentation.

Removed unused `SafeHandle` code and adjusted project configuration to include necessary references.
2025-11-25 12:27:10 +09:00
8418d3df7b Refactor memory management with MemoryHandle
Replaced `SafeHandle` with a new `MemoryHandle` system for improved memory tracking, safety, and leak detection. Updated allocators (`ArenaAllocator`, `HeapAllocator`, `StackAllocator`) and collections (`UnTypedArray`, `UnsafeArray<T>`, `UnsafeBitSet`) to use `MemoryHandle`.

Refactored `AllocationManager` to use `ConcurrentSlotMap` for live allocation tracking and added methods for managing `MemoryHandle` instances. Simplified alignment and padding logic across allocators and collections.

Enhanced performance with optimized memory operations (`MemClear`, `MemSet`, `MemCpy`) and vectorized operations in `MemoryUtility` and `UnsafeBitSet`. Fixed alignment issues in vectorized memory operations.

Updated tests to reflect the new memory management system and added new tests for `UnsafeBitSet` bitwise operations. Enabled `ENABLE_COLLECTION_CHECKS` for debug builds and improved error messages and documentation.

Removed unused `SafeHandle` code and adjusted project configuration to include necessary references.
2025-11-25 00:56:21 +09:00
cced0393d6 Merge branch 'main' of https://git.personalnas.com/Misaki/Misaki.HighPerformance 2025-11-23 13:56:50 +09:00
fe91488319 Update .gitea/workflows/publish-nuget.yaml
Updated workflow
2025-11-23 04:52:25 +00:00
517abd64d6 Updated package version 2025-11-23 13:50:29 +09:00
396f89d33c Update .gitea/workflows/publish-nuget.yaml
Update gitea workflow
2025-11-23 04:38:16 +00:00
e28835caa0 Merge pull request 'Add Roslyn analyzer and code fix for unique ownership' (#4) from develop into main
Reviewed-on: #4
2025-11-23 04:25:37 +00:00
e8b744b7f7 Merge branch 'main' into develop
All checks were successful
Publish NuGet Packages / publish (pull_request) Successful in 2m4s
2025-11-23 04:25:29 +00:00
27dfa67784 Add Roslyn analyzer and code fix for unique ownership
Some checks failed
Publish NuGet Packages / publish (pull_request) Has been cancelled
Introduce a Roslyn analyzer to enforce unique ownership semantics for structs marked with the `[NonCopyable]` attribute. Added a corresponding code fix to resolve violations by suggesting the use of `Share()` or other ownership transfer methods.

Key changes:
- Added `StructCopyCodeAnalyzer` to detect invalid struct copies.
- Implemented `StructCopyCodeFixProvider` to provide code fixes.
- Created `Misaki.HighPerformance.Analyzer` and `CodeFixes` projects.
- Added unit tests for the analyzer and code fixes.
- Introduced `UniquePtr<T>` and `SharedPtr<T>` for pointer ownership.
- Added a Visual Studio extension project and packaging support.
- Updated `UnsafeUtility` to use `nint`/`nuint` for indices.
2025-11-22 18:20:03 +09:00
32ff948268 Update .gitea/workflows/publish-nuget.yaml
Updated gitea workflow to use .net 10
2025-11-18 14:26:48 +00:00
b9ae8ee15e Merge pull request 'develop' (#3) from develop into main
Reviewed-on: #3
2025-11-18 14:25:25 +00:00
c0a0861897 Improve memory safety and alignment handling
Some checks failed
Publish NuGet Packages / publish (pull_request) Failing after 1m5s
- Updated `.gitignore` to include `.vscode/` and clarified comments.
- Introduced `SafeHandle` for managing memory alignment and safe access.
- Refactored `UnsafeArray<T>` to add bounds checking and alignment logic.
- Added `IUnsafeHashCollection<T>` for specialized hash-based collections.
- Refactored `UnsafeHashMap<TKey, TValue>` and `UnsafeHashSet<T>` to use `HashMapHelper<TKey>` with alignment support.
- Made `UnsafeSlotMap<T>` methods `readonly` for immutability.
- Enhanced `HashMapHelper<TKey>` with alignment-aware buffer management and validation.
- Updated benchmarks to use `UnsafeArray<Vector256<int>>` and added capacity checks.
- Incremented assembly version to `1.1.3` in `Misaki.HighPerformance.LowLevel.csproj`.
- Updated `Program.cs` to run `CollectionBenchmark` and demonstrate safe disposal handling.
2025-11-18 01:25:40 +09:00
57725369f9 Merge branch 'develop' of https://git.personalnas.com/Misaki/Misaki.HighPerformance into develop 2025-11-14 11:14:43 +09:00
24a7d49ae2 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`.
2025-11-14 11:14:09 +09:00
4363081142 Merge pull request 'Refactor unsafe collections and improve memory handling' (#2) from develop into main
Reviewed-on: #2
2025-11-11 12:21:39 +00:00
c363296727 Merge branch 'main' into develop
All checks were successful
Publish NuGet Packages / publish (pull_request) Successful in 1m45s
2025-11-11 12:21:32 +00:00
bf4dd5670e Refactor unsafe collections and improve memory handling
Some checks failed
Publish NuGet Packages / publish (pull_request) Has been cancelled
Refactored enumerators across multiple unsafe collections to use
`ref` returns for `Current`, improving performance and reducing
memory usage. Enhanced memory management with `AllocationOption`
support and optimized resizing logic for collections like
`UnsafeBitSet`, `UnsafeSlotMap`, and `UnsafeSparseSet`.

Updated `publish-nuget.yaml` to support manual workflow dispatch
and trigger on `push`/`pull_request` events. Incremented project
version to `1.1.2` and ensured NuGet package generation on build.
2025-11-11 21:20:33 +09:00
f2e2051378 Merge pull request 'Fixed bug that SlotMap.Contains does not return a correct value.' (#1) from develop into main
All checks were successful
Publish NuGet Packages / publish (push) Successful in 1m57s
Reviewed-on: #1
2025-11-11 08:39:11 +00:00
bc8b2c0aaa Fixed bug that SlotMap.Contains does not return a correct value.
Some checks failed
Publish NuGet Packages / publish (pull_request) Failing after 6s
2025-11-11 17:38:30 +09:00
e97b295b05 Update package version.
All checks were successful
Publish NuGet Packages / publish (push) Successful in 1m46s
2025-11-06 15:02:44 +09:00
fbe72e33f7 Refactor AllocationManager and enhance debug tracking
Refactored `AllocationManager` to introduce intrusive allocation tracking with `AllocationHeader` structs for debug mode. Added lightweight allocation counters for non-debug mode. Enhanced memory leak detection with detailed stack traces and `MemoryLeakException`.

Simplified `AllocationInfo` by removing the `Allocator` property. Updated `AllocationOption` enum to remove `UnTracked` and clarified documentation.

Improved unsafe collections (`UnsafeArray`, `UnsafeStack`, etc.) with strongly-typed enumerators and better compatibility with `IEnumerable<T>`. Enhanced `UnsafeStack` with a dedicated `Enumerator` struct and consistent constructor parameters.

Refactored `MemoryLeakException` to support detailed allocation info and improved stack trace formatting. Simplified `MemoryUtility` by removing redundant null checks.

Added unit tests for `AllocationManager`, `UnsafeArray`, and `UnsafeStack` to validate memory management and functionality. Updated `Program.cs` with new examples.

Cleaned up namespaces, removed redundant `using` directives, and improved XML documentation. Applied `MethodImplOptions.AggressiveInlining` to performance-critical methods.
2025-11-06 01:28:43 +09:00
b914716225 Fix package dependency problem
All checks were successful
Publish NuGet Packages / publish (push) Successful in 1m47s
2025-11-04 20:48:25 +09:00
308c70d0e1 Fix nuget push command
All checks were successful
Publish NuGet Packages / publish (push) Successful in 1m46s
2025-11-04 20:23:24 +09:00
f708116eea Fix package name searching
Some checks failed
Publish NuGet Packages / publish (push) Failing after 1m51s
2025-11-04 20:16:51 +09:00
36b8bd06d5 Update workflow;
Some checks failed
Publish NuGet Packages / publish (push) Failing after 1m41s
2025-11-04 18:32:44 +09:00
b32d4ca1b7 Merge branch 'main' of https://git.personalnas.com/Misaki/Misaki.HighPerformance 2025-11-04 18:20:02 +09:00
f14f3b07cd Update package info
All checks were successful
Publish NuGet Packages / publish (push) Successful in 1m39s
2025-11-04 18:19:05 +09:00
5867895e95 Update .gitea/workflows/publish-nuget.yaml
Fix the searching path
2025-11-04 09:16:10 +00:00
8395914cef Fix workflow
Some checks failed
Publish NuGet Packages / publish (push) Failing after 1m36s
2025-11-04 18:08:04 +09:00
fa7f270430 Fixe msbuild issue in workflow
All checks were successful
Publish NuGet Packages / publish (push) Successful in 1m24s
2025-11-04 18:02:39 +09:00
30e9809a9f Merge branch 'main' of https://git.personalnas.com/Misaki/Misaki.HighPerformance
Some checks failed
Publish NuGet Packages / publish (push) Failing after 1m25s
# Conflicts:
#	.gitea/workflows/publish-nuget.yaml
2025-11-04 17:57:50 +09:00
f20734ee76 Fix indentation 2025-11-04 17:57:36 +09:00
d941609ae0 Update .gitea/workflows/publish-nuget.yaml
Fix workflow bug
2025-11-04 08:54:36 +00:00
b2fda1c01b Merge branch 'main' of https://git.personalnas.com/Misaki/Misaki.HighPerformance
# Conflicts:
#	.gitea/workflows/publish-nuget.yaml
2025-11-04 17:52:24 +09:00
fd1ed8793d update gitea workflow; 2025-11-04 17:50:45 +09:00
3d0d705956 update gitea workflow;
Some checks failed
Publish NuGet Packages / publish (push) Failing after 1m25s
2025-11-04 17:39:31 +09:00
49e1171781 Refactor and enhance math and utility libraries
Some checks failed
Publish NuGet Packages / publish (push) Failing after 3m12s
Refactored `sincos` usage across `quaternion` and `random` to use `out` parameters for improved performance. Enhanced `random` struct with updated random direction generation methods.

Added new benchmarks in `MathematicsBenchmark` for vector operations, including SIMD-based `f4` struct. Downgraded target framework to `net9.0` for compatibility.

Introduced `ReadOnlyUnsafeCollection` for low-level memory management. Added utility methods in `CollectionUtility` for span creation and optimized list operations.

Renamed `MemoryUtilities` to `MemoryUtility` and updated all references. Enhanced `ObjectPool` with `Rent` and `TryRent` methods. Enabled `AllowUnsafeBlocks` and AOT compatibility in project configuration.

Performed general code cleanup, including removal of unused methods, improved formatting, and alignment with modern coding practices.
2025-11-04 14:53:01 +09:00
081103372f Refactor memory management and improve allocation APIs
Updated `ReallocFunc` to support `oldSize`, `newSize`, and `AllocationOption`, enabling more granular control over memory reallocation. Simplified `AllocationInfo` by removing the `FreeHandler` property. Enhanced `Reallocate` and `Allocate` methods in `AllocationManager` to handle memory clearing and tracking more effectively.

Refactored `UnsafeSparseSet` to use `UnsafeArray<T>` directly, added a `generations` array, and replaced the `freeList` with `UnsafeStack<int>` for better performance and simplicity. Updated `Resize`, `Add`, and `Remove` methods to improve memory handling and code clarity.

Introduced `AllocationOption` support in `Resize` methods across `IUnsafeCollection` implementations for flexible resizing behavior. Added `GetUnsafePtr` extension methods in `UnsafeUtilities` for direct access to span data.

Added new tests for `UnsafeSparseSet` to validate resizing, clearing, enumeration, and memory compaction. These changes improve memory management, enhance performance, and ensure correctness.
2025-10-08 15:40:49 +09:00
a92ab93731 Refactor and enhance math utilities and code generation
Refactored `StbImage` classes to be publicly accessible. Updated namespaces and introduced `NumericTypeAttribute` for metadata. Enhanced `VectorGenerator` with new utility methods (`any`, `all`, `length`, etc.) and improved code generation. Consolidated vector operations in `math` utilities.

Refactored `Plane` and `svd` classes for better encapsulation and readability. Improved `DynamicArray` with `uint` indexer support and cleaner loops. Added SIMD-based benchmarking placeholders in `MathematicsBenchmark`.

Removed redundant code and unused files, including `IUnsafeSet.cs`. Updated project file to include `CodeGen` as an analyzer. Introduced `SupportedVectorMath` and `SupportedMatrixMath` enums for better operation definitions.

Improved code style, fixed minor bugs, and cleaned up unused code in `Program.cs`. Enhanced maintainability and readability across the codebase.
2025-10-04 12:38:53 +09:00
ac73e28f26 Refactor and enhance math, memory, and utilities
Refactored `sincos` usage in `quaternion` to use tuple-based
returns for improved readability. Introduced a `random` struct
with methods for generating random values of various types
and dimensions, including ranges and directions. Added a
`DynamicArray` class for dynamic resizing and manipulation
of collections. Enhanced `SlotMap` with new methods for
safe access and updates.

Updated `uint` vector types with `NumericConvertable`
attributes for better type interoperability. Removed the
`MathUtilities` class and refactored `adj` and `adjInverse`
methods for encapsulation. Improved memory management
with `StackAllocator` and `UnsafeArray` enhancements.

Added geometry utilities like `AABB`, `OBB`, `Plane`, and
`SphereBounds` for 3D operations. Updated project
configuration for versioning and NuGet packaging.
Performed general code cleanup, improved validation, and
aligned with modern C# practices.
2025-09-23 22:57:12 +09:00
73a0c6e187 Update workflow 2025-09-11 18:47:33 +09:00
94f10de90e Added WaitAll and WaitAny to JobScheduler;
Added generation support to UnsafeSparseSet;
2025-09-11 18:45:40 +09:00
1546c2cabe Updated workflow error 2025-09-11 10:57:18 +09:00
02e173415e Added new giteaaction 2025-09-11 10:54:34 +09:00