예제 #1
0
        public async Task LoadFromDbAsync()
        {
            var beforeStart = dotMemory.Check();
            var dict        = new Dictionary <int, ProductInfo>(HelperTest.ProductCount);
            await DbReadingTest.LoadCoreAsync(dict);

            var stringPool = StringPool.Shared;

            foreach (var(_, p) in dict)
            {
                p.Color = stringPool.GetOrAdd(p.Color);
            }
            GC.Collect();
            dotMemory.Check(memory =>
            {
                var snapshotDifference = memory.GetDifference(beforeStart);
                Console.WriteLine(snapshotDifference.GetNewObjects().SizeInBytes.Bytes());
            });
        }
예제 #2
0
        public async Task LoadFromDbAsync()
        {
            var beforeStart = dotMemory.Check();
            var dict        = new Dictionary <int, ProductInfo>(HelperTest.ProductCount);
            await DbReadingTest.LoadCoreAsync(dict);

            foreach (var(_, p) in dict)
            {
                var colorIndex = HelperTest.Colors.BinarySearch(p.Color);
                var color      = HelperTest.Colors[colorIndex];
                p.Color = color;
            }

            GC.Collect();
            dotMemory.Check(memory =>
            {
                var snapshotDifference = memory.GetDifference(beforeStart);
                Console.WriteLine(snapshotDifference.GetNewObjects().SizeInBytes.Bytes());
            });
        }