예제 #1
0
        public void GetByCode()
        {
            var source = new AddressParser(Log, FolderWithLucene);

            var list = new string[]
            {
                "500000360000039",
                "010000010000095",
                "010000010000000",
                "470130009190000",
                "220610000010033",
            };

            long total = 0;
            int count = 0;
            for (int i = 0; i < 10; i++)
            {
                foreach (var code in list)
                {
                    count++;

                    var b = DateTime.UtcNow.Ticks;
                    var d = source.GetByCode(code);

                    System.Diagnostics.Trace.WriteLine(code + ": " + d.ToString());
                    total += (DateTime.UtcNow.Ticks - b);
                }
            }
            System.Diagnostics.Trace.WriteLine(string.Format("Total: {0} ms", 1.0 * total / (TimeSpan.TicksPerMillisecond * count)));
        }