Esempio n. 1
0
        private static long HashTrieGet <V>(HashTrie <V> trie, int key, int times)
        {
            V   ignored = default(V);
            var watch   = Stopwatch.StartNew();

            for (int i = 0; i < times; i++)
            {
                ignored = trie.GetValueOrDefault(key);
            }

            watch.Stop();
            GC.KeepAlive(ignored);
            GC.Collect();
            return(watch.ElapsedMilliseconds);
        }
Esempio n. 2
0
        private static long TrieGet <T>(HashTrie <Type, T> tree, Type key, int times)
        {
            T ignored = default(T);

            var treeWatch = Stopwatch.StartNew();

            for (int i = 0; i < times; i++)
            {
                ignored = tree.GetValueOrDefault(key);
            }

            treeWatch.Stop();
            GC.KeepAlive(ignored);
            GC.Collect();
            return(treeWatch.ElapsedMilliseconds);
        }