Introduce IntKeyedDictionary
to improve performance.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Collections.Specialized;
|
||||
using Cryville.Common.Pdt;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using RBeatTime = Cryville.Crtr.BeatTime;
|
||||
using RClip = Cryville.Crtr.Clip;
|
||||
@@ -100,7 +100,7 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
}
|
||||
public class Enum<T> : PropOp {
|
||||
static readonly Dictionary<int, int> _cache = new Dictionary<int, int>();
|
||||
static readonly IntKeyedDictionary<int> _cache = new IntKeyedDictionary<int>();
|
||||
readonly Action<T> _cb;
|
||||
readonly Func<int, T> _caster;
|
||||
static Enum() {
|
||||
@@ -109,7 +109,6 @@ namespace Cryville.Crtr {
|
||||
var names = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Static);
|
||||
for (int i = 0; i < names.Length; i++)
|
||||
_cache[IdentifierManager.SharedInstance.Request(names[i].Name)] = Convert.ToInt32(names[i].GetValue(null));
|
||||
|
||||
}
|
||||
public Enum(Action<T> cb, Func<int, T> caster) {
|
||||
_cb = cb;
|
||||
|
Reference in New Issue
Block a user