public void ComparePoolsPerformance() { int capacity = Environment.ProcessorCount * 2; var arrayPool = new ObjectPoolArray <DummyPoolable>(capacity); var bagPool = new ObjectPoolBag <DummyPoolable>(capacity); var queuePool = new ObjectPoolQueue <DummyPoolable>(capacity); //var mpmcQueuePool = new ObjectPoolMPMCQueue<DummyPoolable>(capacity); for (int round = 0; round < 10; round++) { TestPool(arrayPool); TestPool(bagPool); TestPool(queuePool); //TestPool(mpmcQueuePool); Console.WriteLine("----------"); } }
// Use this for initialization void Start() { objectPool = GetComponent <ObjectPoolQueue>(); objectPool.Init(prefab, initialAmount); }