Cleanup CategorizedPool.

This commit is contained in:
2023-02-12 17:27:54 +08:00
parent f60ba1088d
commit 87362b47c5
3 changed files with 63 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
using Cryville.Common;
using Cryville.Common.Buffers;
using System.Collections.Generic;
namespace Cryville.Crtr.Event {
internal class MotionCache {
@@ -25,9 +26,12 @@ namespace Cryville.Crtr.Event {
obj.Valid = false;
}
}
readonly Dictionary<Identifier, ObjectPool<MotionCache>> m_buckets;
protected override IReadOnlyDictionary<Identifier, ObjectPool<MotionCache>> Buckets { get { return m_buckets; } }
public MotionCachePool() {
m_buckets = new Dictionary<Identifier, ObjectPool<MotionCache>>(ChartPlayer.motionRegistry.Count);
foreach (var reg in ChartPlayer.motionRegistry)
Buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
m_buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
}
}
}