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); } }
public void BitPseudoLru_cache_half(Test t) { var cache = new BitPseudoLruMap <string, string>(valueIsKey.WithThunderingHerdProtection(), keys.Length / 2); ReadMixKeys(keys, cache, t); Console.WriteLine($"BitPseudoLru half {valueIsKey.HitCount} hits to underlying data source, {pm.Stop()}"); GC.KeepAlive(cache); GC.KeepAlive(keys); }