asc-community / asc-community/HonkPerf.NET

Add more types (Dictionary etc)

Open
#10 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
172
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Just tried this and seems to not allocate in Unity. Something more generic like IReadOnlyCollection can't be used as it allocates.
```
public static RefLinqEnumerable> ToRefLinq(this HashSet c) => new(new(c));
public struct HashSetEnumerator : IRefEnumerable
{
private T curr;
private HashSet.Enumerator ie;

public HashSetEnumerator(HashSet list)
{
ie = list.GetEnumerator();
curr = default;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool MoveNext()
{
bool end = ie.MoveNext();
curr = ie.Current;
if(!end)
ie.Dispose();
return end;
}
public T Current => curr;
}
```
No idea if that Dispose is correct.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.