コード例 #1
0
        static void Main(string[] args)
        {
            Console.Title = "DataTanker Performance Tests";
            Console.WriteLine("Press Enter to run");
            Console.ReadLine();

            Console.WriteLine("BPlusTree tests");

            BPlusTreeStorageTests.StoragePath = _storagePath;

            TimeMeasure.Start("Overall");

            RunTest("BPlusTree: InsertAndReadMillionRecords", BPlusTreeStorageTests.InsertAndReadMillionRecords);
            RunTest("BPlusTree: InsertLargeValues", BPlusTreeStorageTests.InsertLargeValues);
            RunTest("BPlusTree: RandomOperations", BPlusTreeStorageTests.RandomOperations);

            TimeMeasure.Stop("Overall");
            PrintResults();
            TimeMeasure.Clear();

            Console.WriteLine("RadixTree tests");

            RadixTreeStorageTests.StoragePath = _storagePath;

            TimeMeasure.Start("Overall");

            RunTest("RadixTree: EnglishWords", RadixTreeStorageTests.EnglishWords);

            TimeMeasure.Stop("Overall");
            PrintResults();

            Console.ReadLine();
        }
コード例 #2
0
        void OnGUI()
        {
            GUILayout.BeginVertical(GUI.skin.box);
            GUILayout.Label("Curvy offers various options to fine-tune performance vs. precision balance:");
            // Interpolation
            GUILayout.BeginHorizontal();
            GUILayout.Label("Interpolation: ");
            if (GUILayout.Toggle(mInterpolation == CurvyInterpolation.Linear, "Linear", GUI.skin.button))
            {
                mInterpolation = CurvyInterpolation.Linear;
            }
            if (GUILayout.Toggle(mInterpolation == CurvyInterpolation.Bezier, "Bezier", GUI.skin.button))
            {
                mInterpolation = CurvyInterpolation.Bezier;
            }
            if (GUILayout.Toggle(mInterpolation == CurvyInterpolation.CatmullRom, "CatmullRom", GUI.skin.button))
            {
                mInterpolation = CurvyInterpolation.CatmullRom;
            }
            if (GUILayout.Toggle(mInterpolation == CurvyInterpolation.TCB, "TCB", GUI.skin.button))
            {
                mInterpolation = CurvyInterpolation.TCB;
            }
            GUILayout.EndHorizontal();
            // Orientation
            GUILayout.BeginHorizontal();
            GUILayout.Label("Orientation: ");
            if (GUILayout.Toggle(mOrientation == CurvyOrientation.None, "None", GUI.skin.button))
            {
                mOrientation = CurvyOrientation.None;
            }
            if (GUILayout.Toggle(mOrientation == CurvyOrientation.Static, "Static", GUI.skin.button))
            {
                mOrientation = CurvyOrientation.Static;
            }
            if (GUILayout.Toggle(mOrientation == CurvyOrientation.Dynamic, "Dynamic", GUI.skin.button))
            {
                mOrientation = CurvyOrientation.Dynamic;
            }
            GUILayout.EndHorizontal();
            // CP-Count
            GUILayout.BeginHorizontal();
            GUILayout.Label("Control Points (max): " + mControlPointCount.ToString());
            mControlPointCount = (int)GUILayout.HorizontalSlider(mControlPointCount, 2, 1000);
            GUILayout.EndHorizontal();
            // Length
            GUILayout.BeginHorizontal();
            GUILayout.Label("Total spline length: " + mTotalSplineLength.ToString());
            mTotalSplineLength = (int)GUILayout.HorizontalSlider(mTotalSplineLength, 5, 10000);
            GUILayout.EndHorizontal();
            // Cache
            GUILayout.BeginHorizontal();
            GUILayout.Label("Cache Density: " + mCacheSize.ToString());
            mCacheSize = (int)GUILayout.HorizontalSlider(mCacheSize, 1, 100);
            GUILayout.EndHorizontal();
            mUseCache        = GUILayout.Toggle(mUseCache, "Use Cache (where applicable)");
            mUseMultiThreads = GUILayout.Toggle(mUseMultiThreads, "Use Multiple Threads (where applicable)");
            GUILayout.Label("Select Test:");

            int sel = GUILayout.SelectionGrid(Mathf.Max(0, mCurrentTest), mTests.ToArray(), 4);

            if (sel != mCurrentTest)
            {
                mCurrentTest = sel;
                Timer.Clear();
                mTestResults.Clear();
                mGUIMethod = GetType().GetMethod("GUI_" + mTests[mCurrentTest], BindingFlags.NonPublic | BindingFlags.Instance);
                mRunMethod = GetType().GetMethod("Test_" + mTests[mCurrentTest], BindingFlags.NonPublic | BindingFlags.Instance);
            }
            GUILayout.Space(5);
            if (mGUIMethod != null)
            {
                mGUIMethod.Invoke(this, null);
            }
            GUI.enabled = !mExecuting && mRunMethod != null;
            string label = (mExecuting) ? "Please wait..." : "Run (" + LOOPS + " times)";

            if (GUILayout.Button(label))
            {
                mExecuting = true;
                Timer.Clear();
                mTestResults.Clear();
                Invoke("runTest", .5f);
            }
            GUI.enabled = true;
            if (Timer.Count > 0)
            {
                foreach (var s in mTestResults)
                {
                    GUILayout.Label(s);
                }
                GUILayout.Label(string.Format("Average (ms): {0:0.0000}", Timer.AverageMS));
                GUILayout.Label(string.Format("Minimum (ms): {0:0.0000}", Timer.MinimumMS));
                GUILayout.Label(string.Format("Maximum (ms): {0:0.0000}", Timer.MaximumMS));
            }

            GUILayout.EndVertical();
        }