Refactor unsafe collections and improve memory handling
Some checks failed
Publish NuGet Packages / publish (pull_request) Has been cancelled
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.
This commit is contained in:
@@ -19,19 +19,14 @@ public unsafe struct UnsafeHashSet<T> : IUnsafeCollection<T>, IEnumerable<T>
|
||||
{
|
||||
internal HashMapHelper<T>.Enumerator _enumerator;
|
||||
|
||||
public readonly T Current => _enumerator.buffer->_keys[_enumerator.index];
|
||||
readonly object IEnumerator.Current => Current;
|
||||
|
||||
public Enumerator(HashMapHelper<T>* hashMap)
|
||||
{
|
||||
_enumerator = new HashMapHelper<T>.Enumerator(hashMap);
|
||||
}
|
||||
|
||||
public T Current
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _enumerator.buffer->_keys[_enumerator.index];
|
||||
}
|
||||
|
||||
object IEnumerator.Current => Current;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool MoveNext() => _enumerator.MoveNext();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user