public ThunderingHerdOverheadTests(Test t)
 {
     if (Tests.Short)
     {
         t.Skip();
     }
     valueIsKey = new ValueIsKey <string, string> {
         SleepFor = TimeSpan.FromMilliseconds(10)
     };
     pm = new PerformaceMonitor(start: true);
 }
        public void concurrent_dictionary_memory_overhead(Test t)
        {
            foreach (var items in testSizes)
            {
                string[] keys = CreateKeyStrings(items);
                var      pm   = new PerformaceMonitor(start: true);

                var cache = new ConcurrentDictionary <string, string>();
                ReadMixKeys(keys, cache, t);

                pm.Stop();
                t.Log($"concurrent_dictionary_memory_overhead of {items} items {pm.Stop()}");
                GC.KeepAlive(cache);
                GC.KeepAlive(keys);
            }
        }
        public void generational_cache_half(Test t)
        {
            foreach (var items in testSizes)
            {
                string[] keys = CreateKeyStrings(items);
                var      pm   = new PerformaceMonitor(start: true);

                var cache = valueIsKey.WithGenerationalCache(items / 4, null);
                ReadMixKeys(keys, cache, t);
                cache.Dispose();
                pm.Stop();
                t.Log($"generational_cache_half of {items} items {pm.Stop()}");
                GC.KeepAlive(cache);
                GC.KeepAlive(keys);
            }
        }
        public void generational_timed(Test t)
        {
            foreach (var items in testSizes)
            {
                string[] keys = CreateKeyStrings(items);
                var      pm   = new PerformaceMonitor(start: true);

                var cache = valueIsKey.WithGenerationalCache(null, TimeSpan.FromMilliseconds(100));
                ReadMixKeys(keys, cache, t);
                cache.Dispose();
                pm.Stop();
                t.Log($"generational_timed of {items} items {pm.Stop()}");
                GC.KeepAlive(cache);
                GC.KeepAlive(keys);
            }
        }
        public void BitPseudoLru_cache_half(Test t)
        {
            foreach (var items in testSizes)
            {
                string[] keys = CreateKeyStrings(items);
                var      pm   = new PerformaceMonitor(start: true);

                var cache = new BitPseudoLruMap <string, string>(valueIsKey, items / 2);
                ReadMixKeys(keys, cache, t);

                pm.Stop();
                t.Log($"BitPseudoLru_cache_half of {items} items {pm.Stop()}");
                GC.KeepAlive(cache);
                GC.KeepAlive(keys);
            }
        }