Exemple #1
0
        private void TEST_10_VisMid(SpeedStatistic.Counter cntr, string tableForCount)
        {
            totalElapsed += cntr.ElapsedMs;
            totalElapsedQ++;

            if (totalElapsedQ == threadsQuantity)
            {
                Console.WriteLine("MID time: {0};", totalElapsed / totalElapsedQ);

                //SpeedStatistic.StopCounter("START ALL");
                //SpeedStatistic.PrintOut("START ALL");

                var totalCntr = SpeedStatistic.GetCounter("START ALL");
                totalCntr.Stop();
                totalCntr.PrintOut();

                using (var tran = engine.GetTransaction())
                {
                    ulong nrnsCnt = tran.Count(tableForCount);
                    ulong speed   = 0;

                    if (totalCntr.ElapsedMs > 0)
                    {
                        speed = (ulong)((double)nrnsCnt * 1000 / (double)totalCntr.ElapsedMs);
                    }

                    Console.WriteLine("Total Nrns: {0}; Speed: {1} records/sec", nrnsCnt, speed);
                }

                SpeedStatistic.ClearAll();
            }
            //Console.WriteLine(totalElapsedQ);
        }
Exemple #2
0
        private void TEST_7()
        {
            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("INSERT RANDOM");
                    int    vl  = 0;
                    Random rnd = new Random();
                    for (int i = 0; i < 100000; i++)
                    {
                        vl = rnd.Next(1000000);

                        tran.Insert <int, byte[]>("t5", vl, null);
                        //tran.Commit();
                    }

                    tran.Commit();


                    SpeedStatistic.StopCounter("INSERT RANDOM");

                    SpeedStatistic.PrintOut("INSERT RANDOM");
                    SpeedStatistic.ClearAll();

                    //FileInfo fi=new FileInfo(@"D:\temp\DBreezeBenchmark\10000002");
                    //Console.WriteLine(fi.Length);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #3
0
        private void TEST_8()
        {
            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("SELECT");

                    int    cnt = 0;
                    byte[] val = null;
                    //foreach (var row in tran.SelectBackward<DateTime, byte[]>("t2").Take(1000000))
                    foreach (var row in tran.SelectForward <byte[], byte[]>("t2").Take(1000000))
                    {
                        //val = row.Value;
                        cnt++;
                    }

                    Console.WriteLine(cnt);

                    SpeedStatistic.StopCounter("SELECT");

                    SpeedStatistic.PrintOut("SELECT");
                    SpeedStatistic.ClearAll();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #4
0
        private void TEST_1()
        {
            engine.Scheme.DeleteTable("t1");

            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("INSERT");

                    for (int i = 0; i < 1000000; i++)
                    {
                        tran.Insert <int, byte[]>("t1", i, null);
                    }

                    tran.Commit();
                    SpeedStatistic.StopCounter("INSERT");

                    SpeedStatistic.PrintOut(true);

                    //INSERT: 1; Time: 9256 ms; 25292025 ticks
                    //FS: 18MB
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #5
0
        private void TEST_6()
        {
            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("COPY");
                    int cnt = 0;
                    foreach (var row in tran.SelectForward <int, byte[]>("t3"))
                    {
                        //!!!!!!!!!!!!!!!   HERE we make HDD head to move too much R-W-R-W...better read first chunk 1MLN in memory then save etc till the end R-R-R-W-R-R-R-W
                        tran.Insert <int, byte[]>("t4", row.Key, row.Value);
                        cnt++;
                    }

                    tran.Commit();

                    SpeedStatistic.StopCounter("COPY");

                    SpeedStatistic.PrintOut("COPY");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #6
0
        private void TEST_5(int num)
        {
            using (var tran = engine.GetTransaction())
            {
                try
                {
                    //SpeedStatistic.StartCounter("S ");
                    //var cnt = tran.Count("t3");
                    //tran.Select<int, byte[]>("t3",10);
                    //SpeedStatistic.StopCounter("S ");
                    //SpeedStatistic.PrintOut("S ");

                    SpeedStatistic.StartCounter("INSERT " + num);

                    int k = num;

                    for (int i = 0; i < 1000000; i++)
                    {
                        tran.Insert <int, byte[]>("t3", k, null);
                        k += 255;
                    }

                    tran.Commit();

                    SpeedStatistic.StopCounter("INSERT " + num);

                    SpeedStatistic.PrintOut("INSERT " + num);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #7
0
        private void TEST_8_5()
        {
            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("SELECT");


                    int      cnt      = 0;
                    byte[]   val      = null;
                    DateTime dtSearch = new DateTime(1970, 7, 1);
                    //dtSearch = new DateTime(1971, 6, 1);
                    dtSearch = new DateTime(1972, 1, 1);
                    foreach (var row in tran.SelectForwardStartFrom <DateTime, byte[]>("t2", dtSearch, true).Take(100000))
                    {
                        val = row.Value;
                        cnt++;
                    }

                    Console.WriteLine(cnt);

                    SpeedStatistic.StopCounter("SELECT");

                    SpeedStatistic.PrintOut("SELECT");
                    SpeedStatistic.ClearAll();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #8
0
        private void TEST_10_insertNeuron(ulong startNeuron, ulong quantity, bool showSingleStat)
        {
            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("INSERT NEURON " + startNeuron.ToString());

                    for (ulong i = startNeuron; i < (quantity + startNeuron); i++)
                    {
                        tran.Insert <ulong, byte[]>("Neurons", i, null);
                        tran.Commit();
                    }


                    var cntr = SpeedStatistic.GetCounter("INSERT NEURON " + startNeuron.ToString());

                    if (showSingleStat)
                    {
                        SpeedStatistic.PrintOut("INSERT NEURON " + startNeuron.ToString());
                    }

                    SpeedStatistic.StopCounter("INSERT NEURON " + startNeuron.ToString());

                    TEST_10_VisMid(cntr, "Neurons");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #9
0
        private void TEST_3_1_STARTER_2()
        {
            threadsQuantity = 100;
            threadsQuantity = 6;

            SpeedStatistic.StartCounter("START ALL");
            for (int i = 0; i < threadsQuantity; i++)
            {
                Start312("t3" + i.ToString());
            }
        }
Exemple #10
0
        private void TEST_1_9()
        {
            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("SELECT DOT");

                    Random rnd = new Random();
                    int    key = 0;
                    byte[] val = null;
                    int    cc  = 0;

                    //var row1 = tran.Select<int, byte[]>("t1", 983290);
                    //if (row1.Exists)
                    //{
                    //    //val = row1.Value;
                    //}
                    //else
                    //{
                    //    cc++;
                    //    Console.WriteLine("not found key: " + key);
                    //}


                    for (int i = 0; i < 100000; i++)
                    {
                        key = rnd.Next(999999);
                        //key = i;
                        var row = tran.Select <int, byte[]>("t1", key);
                        if (row.Exists)
                        {
                            val = row.Value;
                        }
                        else
                        {
                            cc++;
                            Console.WriteLine("not found key: " + key);
                        }
                    }

                    Console.WriteLine(cc);
                    SpeedStatistic.StopCounter("SELECT DOT");

                    SpeedStatistic.PrintOut(true);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #11
0
        private void VisMid(SpeedStatistic.Counter cntr)
        {
            totalElapsed += cntr.ElapsedMs;
            totalElapsedQ++;

            if (totalElapsedQ == threadsQuantity)
            {
                Console.WriteLine("MID: {0};", totalElapsed / totalElapsedQ);
                SpeedStatistic.StopCounter("START ALL");
                SpeedStatistic.PrintOut("START ALL");
            }
            //Console.WriteLine(totalElapsedQ);
        }
Exemple #12
0
        /// <summary>
        /// Opening and deleting file
        /// </summary>
        private void TEST_4()
        {
            FileStream _fs = null;
            string     fn  = Path.Combine(_folder, "xxx.rol");

            SpeedStatistic.StartCounter("CREATE FILE");
            for (int i = 0; i < 10000; i++)
            {
                _fs = new FileStream(fn, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
                _fs.Close();

                File.Delete(fn);
            }

            SpeedStatistic.StopCounter("CREATE FILE");
            SpeedStatistic.PrintOut(true);
        }
Exemple #13
0
        /// <summary>
        /// Starter, can be change quantity of threads and insertByOneThread (quant of neurons which must insert every thread)
        /// all happens with one table
        /// </summary>
        private void TEST_10()
        {
            engine.Scheme.DeleteTable("Neurons");

            //Neuro save
            this.threadsQuantity = 100;
            this.totalElapsed    = 0;
            this.totalElapsedQ   = 0;

            //quantity of neurons which must be inserted by one thread
            int insertByOneThread = 100;

            SpeedStatistic.StartCounter("START ALL");
            for (int i = 0; i < threadsQuantity; i++)
            {
                TEST_10_insertNeuron((ulong)(i * insertByOneThread), (ulong)insertByOneThread, false);
            }
        }
Exemple #14
0
        private void TEST_11_insertNeuronConnection(ulong quantityOfConnections, bool showSingleStat)
        {
            using (var tran = engine.GetTransaction())
            {
                try
                {
                    ulong neuron = (ulong)rndNeuron.Next(1000000);

                    string statTable = "INSERT NEURON " + neuron.ToString() + tran.ManagedThreadId.ToString();

                    SpeedStatistic.StartCounter(statTable);

                    byte[] key = null;


                    for (ulong i = 0; i < quantityOfConnections; i++)
                    {
                        ulong neuronConnection = (ulong)rndNeuron.Next(1000000);

                        key = neuron.To_8_bytes_array_BigEndian().Concat(neuronConnection.To_8_bytes_array_BigEndian());

                        tran.Insert <byte[], byte[]>("NeuronsConnections", key, null);
                        tran.Commit();
                    }


                    var cntr = SpeedStatistic.GetCounter(statTable);

                    cntr.Stop();

                    if (showSingleStat)
                    {
                        cntr.PrintOut();
                    }


                    TEST_10_VisMid(cntr, "NeuronsConnections");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #15
0
        private void TEST_9_3()
        {
            int totalTablesToCreate = 1000000;
            //int totalTablesToCreate = 200000;
            //int totalTablesToCreate = 34000;
            int calcStatEveryNtables = 10000;

            byte[] v = null;


            SpeedStatistic.StartCounter("ALL OPER");

            SpeedStatistic.StartCounter("Chunk");

            for (int i = 1; i <= totalTablesToCreate; i++)
            {
                using (var tran = engine.GetTransaction())
                {
                    try
                    {
                        var row = tran.Select <byte[], byte[]>("t" + i, new byte[] { 0 });

                        v = row.Value;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }

                if (i % calcStatEveryNtables == 0)
                {
                    SpeedStatistic.StopCounter("Chunk");
                    SpeedStatistic.PrintOut("Chunk", true);
                    SpeedStatistic.StartCounter("Chunk");
                }
            }


            SpeedStatistic.StopCounter("ALL OPER");
            SpeedStatistic.PrintOut("ALL OPER");
            SpeedStatistic.ClearAll();
        }
Exemple #16
0
        private void TEST_2()
        {
            engine.Scheme.DeleteTable("t2");

            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("INSERT");

                    DateTime dt = new DateTime(1970, 1, 1);

                    for (int i = 0; i < 1000000; i++)
                    //for (int i = 0; i < 1000000; i++)
                    //for (int i = 0; i < 100000; i++)
                    {
                        tran.Insert <DateTime, byte[]>("t2", dt, null);
                        dt = dt.AddSeconds(7);
                    }

                    tran.Commit();

                    Console.WriteLine("LastDt: {0}", dt.ToString("dd.MM.yyyy HH:mm:ss"));

                    SpeedStatistic.StopCounter("INSERT");

                    SpeedStatistic.PrintOut(true);

                    //LastDt: 23.03.1970 00:26:40
                    //100K
                    //FS: 2.2MB, 997 ms
                    //10MLN
                    //FS: 220MB, 98 sec
                    //1mln
                    //INSERT: 1; Time: 9966 ms; 27233088 ticks
                    //FS: 22MB
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #17
0
        private void TEST_3_2()
        {
            //engine.Schema.DeleteTable("t3");

            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("UPDATE");

                    DateTime dt = new DateTime(1970, 1, 1);


                    for (int i = 0; i < 100000; i++)
                    {
                        tran.Insert <DateTime, byte[]>("t3", dt, null);
                        dt = dt.AddSeconds(7);
                        //tran.Commit();
                    }

                    tran.Commit();

                    Console.WriteLine("LastDt: {0}", dt.ToString("dd.MM.yyyy HH:mm:ss"));

                    SpeedStatistic.StopCounter("UPDATE");

                    SpeedStatistic.PrintOut(true);

                    //LastDt: 23.03.1970 00:26:40

                    //U: 100K; FS: 2.9MB; 34 s; Commit After Every Update
                    //U: 1MLN; FS: 29MB; 356 s; Commit After Every Update

                    //U: 100K; FS: 2.9MB; 2.8 s; Commit After All Updates
                    //U: 1MLN; FS: 29MB; 28 s; Commit After All Updates
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #18
0
        private void TEST_9_1()
        {
            int totalTablesToCreate  = 34000;
            int calcStatEveryNtables = 100;

            Random rnd = new Random();
            int    t   = rnd.Next(10);

            t = t + 2;

            SpeedStatistic.StartCounter("ALL OPER");

            SpeedStatistic.StartCounter("Chunk");
            for (int i = 1; i <= totalTablesToCreate; i++)
            {
                using (var tran = engine.GetTransaction())
                {
                    try
                    {
                        tran.Insert <byte[], byte[]>("t" + i, new byte[] { (byte)t }, new byte[] { 0 });
                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }

                if (i % calcStatEveryNtables == 0)
                {
                    SpeedStatistic.StopCounter("Chunk");
                    SpeedStatistic.PrintOut("Chunk", true);
                    SpeedStatistic.StartCounter("Chunk");
                }
            }

            SpeedStatistic.StopCounter("ALL OPER");
            SpeedStatistic.PrintOut("ALL OPER");
            SpeedStatistic.ClearAll();
        }
Exemple #19
0
        /// <summary>
        /// Key dt with good jump, commit after every insert
        /// </summary>
        private void TEST_3()
        {
            engine.Scheme.DeleteTable("t3");

            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("INSERT");

                    DateTime dt = new DateTime(1970, 1, 1);

                    for (int i = 0; i < 100000; i++)
                    //for (int i = 0; i < 1000000; i++)
                    {
                        tran.Insert <DateTime, byte[]>("t3", dt, null);
                        dt = dt.AddSeconds(7);
                        tran.Commit();
                    }

                    //tran.Commit();

                    Console.WriteLine("LastDt: {0}", dt.ToString("dd.MM.yyyy HH:mm:ss"));

                    SpeedStatistic.StopCounter("INSERT");

                    SpeedStatistic.PrintOut(true);

                    //LastDt: 23.03.1970 00:26:40
                    //I: 100K; FS: 2.9MB; 19 s
                    //I: 1MLN; FS: 29MB; 212 s
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #20
0
        private void TEST_9()
        {
            //int totalTablesToCreate = 34000;
            int totalTablesToCreate = 1000000;
            //int totalTablesToCreate = 200000;
            int calcStatEveryNtables = 100;

            SpeedStatistic.StartCounter("ALL OPER");

            //SpeedStatistic.StartCounter("Chunk");

            for (int i = 1; i <= totalTablesToCreate; i++)
            {
                using (var tran = engine.GetTransaction())
                {
                    try
                    {
                        tran.Insert <byte[], byte[]>("t" + i, new byte[] { 0 }, new byte[] { 0 });
                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }

                //if (i % calcStatEveryNtables == 0)
                //{
                //    //SpeedStatistic.StopCounter("Chunk");
                //    //SpeedStatistic.PrintOut("Chunk", true);
                //    //SpeedStatistic.StartCounter("Chunk");
                //}
            }

            SpeedStatistic.StopCounter("ALL OPER");
            SpeedStatistic.PrintOut("ALL OPER");
            SpeedStatistic.ClearAll();
        }
Exemple #21
0
        /// <summary>
        /// Key dt with good jump, commit after every insert
        /// </summary>
        private void TEST_3_1(string tableName)
        {
            //engine.Schema.DeleteTable(tableName);

            using (var tran = engine.GetTransaction())
            {
                try
                {
                    SpeedStatistic.StartCounter("INSERT" + tableName);

                    DateTime dt = new DateTime(1970, 1, 1);


                    for (int i = 0; i < recsQuantity2Insert; i++)
                    {
                        tran.Insert <DateTime, byte[]>(tableName, dt, null);
                        dt = dt.AddSeconds(7);
                        //tran.Commit();
                    }

                    tran.Commit();

                    //Console.WriteLine("LastDt: {0}", dt.ToString("dd.MM.yyyy HH:mm:ss"));

                    SpeedStatistic.StopCounter("INSERT" + tableName);

                    var cntr = SpeedStatistic.GetCounter("INSERT" + tableName);

                    VisMid(cntr);
                    //SpeedStatistic.PrintOut("INSERT" + tableName);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Exemple #22
0
        private void TEST_12()
        {
            SpeedStatistic.StartCounter("START ALL");
            for (int i = 0; i < 1000000; i++)    //3 ms empty loop
            {
                //try
                //{  //3 ms with try-catch
                //}
                //catch (Exception ex)
                //{
                //    Console.WriteLine(ex.ToString());
                //}

                //using (var tran = engine.GetTransaction())        //5820 ms with and without try-catch
                //{

                //}

                DBreeze.Diagnostic.SpeedStatistic.StartCounter("GET");
                //DbReaderWriterLock _sync_transactionWriteTables = new DbReaderWriterLock();
                System.Threading.ReaderWriterLockSlim rwls = new System.Threading.ReaderWriterLockSlim();
                //DBreeze.Transactions.TransactionUnit1 transactionUnit = new DBreeze.Transactions.TransactionUnit1(null);

                //var tran = engine.GetTransaction();
                DBreeze.Diagnostic.SpeedStatistic.StopCounter("GET");

                //DBreeze.Diagnostic.SpeedStatistic.StartCounter("UNREGISTER1");
                ////tran.Dispose();
                //DBreeze.Diagnostic.SpeedStatistic.StopCounter("UNREGISTER1");
            }
            //SpeedStatistic.PrintOut("START ALL",true);


            SpeedStatistic.PrintOut();
            SpeedStatistic.ClearAll();
        }
Exemple #23
0
        private void btTestSearchText_Click(object sender, RoutedEventArgs e)
        {
            //Dictionary<string, HashSet<uint>> d = new Dictionary<string, HashSet<uint>>();
            //d.Add("t1", null);
            //d.Add("t2", new HashSet<uint> { 4, 5, 6 });

            //var btx = Biser.Encode_DICT_PROTO_STRING_UINTHASHSET(d, Compression.eCompressionType.NoCompression);
            //Dictionary<string, HashSet<uint>> d1 = new Dictionary<string, HashSet<uint>>();

            //Biser.Decode_DICT_PROTO_STRING_UINTHASHSET(btx, d1, Compression.eCompressionType.NoCompression);

            //return;
            if (textsearchengine == null)
            {
                textsearchengine = new DBreezeEngine(@"D:\temp\DBR1\");
            }
            MyTask tsk = null;


            using (var tran = textsearchengine.GetTransaction())
            {
                var resp = tran.TextSearch("TaskText", new DBreeze.TextSearch.TextSearchRequest()
                {
                    // SearchLogicType = DBreeze.TextSearch.TextSearchRequest.eSearchLogicType.OR,
                    SearchWords = "Xamarin"
                });
            }

            return;

            //Testing External indexer concept.
            //Table where we will store Docs to be indexed
            using (var tran = textsearchengine.GetTransaction())
            {
                //we want to use table PendingTextSearchIndexing to communicate with AutomaticIndexer (so we will write into it also)
                tran.SynchronizeTables("Tasks", "TaskText");


                //Storing task
                tsk = new MyTask()
                {
                    Id          = 1,
                    Description = "Starting with the .NET Framework version 2.0, well if you derive a class from Random and override the Sample method, the distribution provided by the derived class implementation of the Sample method is not used in calls to the base class implementation of the NextBytes method. Instead, the uniform",
                    Notes       = "distribution returned by the base Random class is used. This behavior improves the overall performance of the Random class. To modify this behavior to call the Sample method in the derived class, you must also override the NextBytes method"
                };
                //Inserting task value must be, of course tsk
                tran.Insert <long, byte[]>("Tasks", tsk.Id, null);

                tran.TextInsertToDocument("TaskText", tsk.Id.To_8_bytes_array_BigEndian(), tsk.Description + " " + tsk.Notes,
                                          new DBreeze.TextSearch.TextSearchStorageOptions()
                {
                    FullTextOnly = false, DeferredIndexing = true
                });

                tsk = new MyTask()
                {
                    Id          = 2,
                    Description = "VI guess in Universal Apps for Xamarin you need to include the assembly when loading embedded resources. I had to change",
                    Notes       = "I work on.NET for UWP.This is super interesting and I'd well love to take a deeper look at it after the holiday. If "
                };
                tran.Insert <long, byte[]>("Tasks", tsk.Id, null);

                tran.TextInsertToDocument("TaskText", tsk.Id.To_8_bytes_array_BigEndian(), tsk.Description + " " + tsk.Notes,
                                          new DBreeze.TextSearch.TextSearchStorageOptions()
                {
                    FullTextOnly = false, DeferredIndexing = true
                });

                tran.Commit();
            }

            return;

            //using (var tran = textsearchengine.GetTransaction())
            //{
            //    tsk = new MyTask()
            //    {
            //        Id = 2,
            //        ExternalId = "x2",
            //        Description = "Very second task ",
            //        Notes = "small"
            //    };
            //    sb.Append(tsk.Description + " " + tsk.Notes);
            //    tran.InsertDocumentText("TaskFullTextSearch" + companyId, tsk.Id.To_8_bytes_array_BigEndian(), sb.ToString(), new DBreeze.TextSearch.TextSearchStorageOptions() { FullTextOnly = false });

            //    tran.Commit();
            //}

            //using (var tran = textsearchengine.GetTransaction())
            //{
            //    var resp = tran.TextSearch("TaskFullTextSearch", new DBreeze.TextSearch.TextSearchRequest()
            //    {
            //        // SearchLogicType = DBreeze.TextSearch.TextSearchRequest.eSearchLogicType.OR,
            //        SearchWords = "review1"
            //    });

            //}
            //return;

            SpeedStatistic.ToConsole = false;
            SpeedStatistic.StartCounter("a");

            //using (var tran = textsearchengine.GetTransaction())
            //{

            //    tsk = new MyTask()
            //    {
            //        Id = 3,
            //        Description = "test review",
            //        Notes = "metro"
            //    };
            //    tran.Insert<long, byte[]>("Tasks", tsk.Id, null);

            //    tran.TextInsertToDocument("TaskFullTextSearch", tsk.Id.To_8_bytes_array_BigEndian(), tsk.Description + " " + tsk.Notes, new DBreeze.TextSearch.TextSearchStorageOptions() { FullTextOnly = false, });
            //    //tran.TextAppendWordsToDocument("TaskFullTextSearch", tsk.Id.To_8_bytes_array_BigEndian(), "cheater", new DBreeze.TextSearch.TextSearchStorageOptions() { FullTextOnly = false, });
            //    //tran.TextRemoveWordsFromDocument("TaskFullTextSearch", tsk.Id.To_8_bytes_array_BigEndian(), "cheater", new DBreeze.TextSearch.TextSearchStorageOptions() { FullTextOnly = true, });


            //    tran.Commit();
            //}
            //return;

            using (var tran = textsearchengine.GetTransaction())
            {
                //we want to store text index in table “TaskFullTextSearch” and task itself in table "Tasks"
                tran.SynchronizeTables("Tasks", "TaskFullTextSearch");

                //Storing task
                tsk = new MyTask()
                {
                    Id          = 1,
                    Description = "Starting with the .NET Framework version 2.0, well if you derive a class from Random and override the Sample method, the distribution provided by the derived class implementation of the Sample method is not used in calls to the base class implementation of the NextBytes method. Instead, the uniform",
                    Notes       = "distribution returned by the base Random class is used. This behavior improves the overall performance of the Random class. To modify this behavior to call the Sample method in the derived class, you must also override the NextBytes method"
                };
                tran.Insert <long, byte[]>("Tasks", tsk.Id, null);

                //Creating text, for the document search. any word or word part (minimum 3 chars, check TextSearchStorageOptions) from Description and Notes will return us this document in the future
                tran.TextInsertToDocument("TaskFullTextSearch", tsk.Id.To_8_bytes_array_BigEndian(), tsk.Description + " " + tsk.Notes, new DBreeze.TextSearch.TextSearchStorageOptions()
                {
                    FullTextOnly = false,
                });


                tsk = new MyTask()
                {
                    Id          = 2,
                    Description = "VI guess in Universal Apps for Xamarin you need to include the assembly when loading embedded resources. I had to change",
                    Notes       = "I work on.NET for UWP.This is super interesting and I'd well love to take a deeper look at it after the holiday. If "
                };
                tran.Insert <long, byte[]>("Tasks", tsk.Id, null);
                tran.TextInsertToDocument("TaskFullTextSearch", tsk.Id.To_8_bytes_array_BigEndian(), tsk.Description + " " + tsk.Notes, new DBreeze.TextSearch.TextSearchStorageOptions()
                {
                    FullTextOnly = false,
                });


                tsk = new MyTask()
                {
                    Id          = 3,
                    Description = "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met",
                    Notes       = "This clause was objected to on the grounds that as people well changed the license to reflect their name or organization it led to escalating advertising requirements when programs were combined together in a software distribution: every occurrence of the license with a different name required a separate acknowledgment. In arguing against it, Richard Stallman has stated that he counted 75 such acknowledgments "
                };
                tran.Insert <long, byte[]>("Tasks", tsk.Id, null);
                tran.TextInsertToDocument("TaskFullTextSearch", tsk.Id.To_8_bytes_array_BigEndian(), tsk.Description + " " + tsk.Notes, new DBreeze.TextSearch.TextSearchStorageOptions()
                {
                    FullTextOnly = false,
                });

                //Committing all together.
                //Though its possible to build an automatic indexer for the huge text and call it in parallel thread and here to store only changed documentIDs which must be indexed.
                //All depends upon necessary insert speed.
                tran.Commit();
            }

            SpeedStatistic.PrintOut("a", true);
        }