public static void RunFastDictionaryBenchTest(int size) { Console.WriteLine("======================================================"); Console.WriteLine("FastDictionary speed test " + size + Environment.NewLine); long[] Arr = new long[size]; Random rand = new Random(123); int tick = 0; string s = null; while (s != "E") { for (int i = 0; i < Arr.Length; i++) { Arr[i] = tick * tick + tick; tick++; } Thread.CurrentThread.Priority = ThreadPriority.Highest; Dictionary <long, long> dict = new Dictionary <long, long>(); string dres = RunTest("Dictionary add", DictAddBench, Arr, dict); dres += ", " + RunTest("contains", DictContainsBench, Arr, dict); dres += ", " + RunTest("get", DictGetBench, Arr, dict); dres += ", " + RunTest("try get", DictTryGetBench, Arr, dict); dres += ", " + RunTest("remove", DictRemoveBench, Arr, dict); Console.WriteLine(dres); FastDictionaryM2 <long, long> Fdict = new FastDictionaryM2 <long, long>(); string res = RunTest("FastDictionary add", DictAddBench, Arr, Fdict); res += ", " + RunTest("contains", DictContainsBench, Arr, Fdict); res += ", " + RunTest("get", DictGetBench, Arr, Fdict); res += ", " + RunTest("try get", DictTryGetBench, Arr, Fdict); res += ", " + RunTest("remove", DictRemoveBench, Arr, Fdict); Console.WriteLine(res); Thread.CurrentThread.Priority = ThreadPriority.Normal; s = "E"; } }
public BehaviourTree() { _treeNodes = new FastDictionaryM2 <long, IBTNode>(); _rootSelector = new BTSelectorNode("Root", this); }