Пример #1
0
        public static void Run(this ILiteDBTest test, string name, Action action)
        {
            var sw = new Stopwatch();

            sw.Start();
            action();
            sw.Stop();

            var time = sw.ElapsedMilliseconds.ToString().PadLeft(5, ' ');
            var seg  = Math.Round(test.Count / sw.Elapsed.TotalSeconds).ToString().PadLeft(8, ' ');

            Console.WriteLine(name.PadRight(15, ' ') + ": " +
                              time + " ms - " +
                              seg + " records/second");
        }
Пример #2
0
        static void RunTest(string name, ILiteDBTest test)
        {
            var title = name + " - " + test.Count + " records";

            Console.WriteLine(title);
            Console.WriteLine("=".PadLeft(title.Length, '='));

            test.Prepare();

            test.Run("Insert", test.Insert);
            test.Run("Bulk", test.Bulk);
            test.Run("Update", test.Update);
            test.Run("CreateIndex", test.CreateIndex);
            test.Run("Query", test.Query);
            test.Run("Delete", test.Delete);
            test.Run("Drop", test.Drop);

            Console.WriteLine("File Size : " + Math.Round((double)test.FileLength / (double)1024, 2).ToString().PadLeft(5, ' ') + " kb");

            test.Dispose();

            Console.WriteLine();
        }