Collections.Pooled icon indicating copy to clipboard operation
Collections.Pooled copied to clipboard

PooledSet is generating GC when item gets removed

Open friuns2 opened this issue 5 years ago • 1 comments

in my test HashSet is much faster and 0 gc

using System.Collections.Generic;
using Collections.Pooled;
using Gma.DataStructures;
using UnityEngine;

public class Test169 : bs
{
    HashSet<int> HashSet = new HashSet<int>(){1,2,3,4,5,6,7,8,9};
    PooledSet<int> PooledSet = new PooledSet<int>(){1,2,3,4,5,6,7,8,9};
    
    public void Update()
    {
        
        using (bs.Profile("pooled"))
            for (int i = 0; i < 1000; i++)
            {
                PooledSet.Remove(2);
            }
        
        using(bs.Profile("list"))
            for (int i = 0; i < 1000; i++)
            {
                HashSet.Remove(2);
            }
        // Debug.Log(dd);
    }
}

friuns2 avatar Jun 23 '20 18:06 friuns2

image

friuns2 avatar Jun 23 '20 18:06 friuns2