public void concurrent_dictionary_memory_overhead(int x) { var pm = new PerformaceMonitor(start: true); var cache = new ConcurrentDictionary <string, string>(); ReadMixKeys(keys, cache); pm.Stop(); Console.WriteLine(pm.Report(keys.Length, cache.Count) + $", {valueIsKey.HitCount} hits to underlying data source"); GC.KeepAlive(cache); GC.KeepAlive(keys); }
public void generational_timed(int x) { var pm = new PerformaceMonitor(start: true); var cache = valueIsKey.WithThunderingHerdProtection().WithGenerationalCache(null, TimeSpan.FromSeconds(5)); ReadMixKeys(keys, cache); cache.Dispose(); pm.Stop(); Console.WriteLine(pm.Report(keys.Length, cache.Count) + $", {valueIsKey.HitCount} hits to underlying data source"); GC.KeepAlive(cache); GC.KeepAlive(keys); }
public void BitPseudoLru_cache_half(int x) { var pm = new PerformaceMonitor(start: true); var cache = new BitPseudoLruMap <string, string>(valueIsKey.WithThunderingHerdProtection(), keys.Length / 2); ReadMixKeys(keys, cache); pm.Stop(); Console.WriteLine(pm.Report(keys.Length, cache.Count) + $", {valueIsKey.HitCount} hits to underlying data source"); GC.KeepAlive(cache); GC.KeepAlive(keys); }
public void concurrent_dictionary_memory_overhead(int items) { string[] keys = CreateKeyStrings(items); var pm = new PerformaceMonitor(start: true); var cache = new ConcurrentDictionary <string, string>(); ReadMixKeys(keys, cache); pm.Stop(); Console.WriteLine(pm.Report(items, cache.Count)); GC.KeepAlive(cache); GC.KeepAlive(keys); }
public void generational_timed(int items) { string[] keys = CreateKeyStrings(items); var pm = new PerformaceMonitor(start: true); var cache = valueIsKey.WithGenerationalCache(null, TimeSpan.FromMilliseconds(100)); ReadMixKeys(keys, cache); cache.Dispose(); pm.Stop(); Console.WriteLine(pm.Report(items, cache.Count)); GC.KeepAlive(cache); GC.KeepAlive(keys); }
public void generational_cache_half(int items) { string[] keys = CreateKeyStrings(items); var pm = new PerformaceMonitor(start: true); var cache = valueIsKey.WithGenerationalCache(items / 4, null); ReadMixKeys(keys, cache); cache.Dispose(); pm.Stop(); Console.WriteLine(pm.Report(items, cache.Count)); GC.KeepAlive(cache); GC.KeepAlive(keys); }
public void BitPseudoLru_cache_half(int items) { string[] keys = CreateKeyStrings(items); var pm = new PerformaceMonitor(start: true); var cache = new BitPseudoLruMap <string, string>(valueIsKey, items / 2); ReadMixKeys(keys, cache); pm.Stop(); Console.WriteLine(pm.Report(items, cache.Count)); GC.KeepAlive(cache); GC.KeepAlive(keys); }