Example #1
0
        public void CreateAllDataEdgesTest([ValueSource(nameof(kCreateAllBlockParamOutput))] CreateAllBlockParam param)
        {
            var viewController    = StartEditTestAsset();
            var contextController = CreateAllBlocks(viewController, param.destContext, param.blocks);

            CreateDataEdges(viewController, contextController, CreateAllParameters(viewController));
        }
Example #2
0
        public void CreateAllBlocksTest([ValueSource(nameof(kCreateAllBlockParam))] CreateAllBlockParam param)
        {
            var viewController = StartEditTestAsset();

            CreateAllBlocks(viewController, param.destContext, param.blocks);
        }
Example #3
0
        //[UnityTest] Not really a test but helper to profile the controller invalidation.
        public IEnumerator ExperimentCreateAllBlocksTiming([ValueSource(nameof(kApplyChange))] bool applyChanges, [ValueSource(nameof(kApplyChange))] bool blocks)
        {
            var referenceBlock    = VFXLibrary.GetBlocks().Where(t => t.model is Block.KillSphere).First();
            var referenceOperator = VFXLibrary.GetOperators().Where(t => t.model is Operator.DistanceToSphere).First();
            var referenceContext  = VFXLibrary.GetContexts().Where(t => t.model is VFXBasicUpdate).First();

            var param = new CreateAllBlockParam()
            {
                name        = "Test",
                destContext = referenceContext
            };

            var results = new List <(int, double)>();

            int modelCount = 1;

            while (modelCount < 512)
            {
                var watch = new System.Diagnostics.Stopwatch();
                watch.Start();

                if (modelCount >= 256)
                {
                    modelCount += 128;
                }
                else
                {
                    modelCount *= 2;
                }

                var controller = StartEditTestAsset();

                if (blocks)
                {
                    param.blocks = Enumerable.Repeat(referenceBlock, modelCount);
                    CreateAllBlocksExperiment(controller, param.destContext, param.blocks, applyChanges);
                }
                else
                {
                    var operators = Enumerable.Repeat(referenceOperator, modelCount);
                    CreateAllOperatorsExperiment(controller, operators, applyChanges);
                }

                watch.Stop();
                var stopwatchElapsed = watch.Elapsed;
                results.Add((modelCount, stopwatchElapsed.TotalMilliseconds));

                //Clean up for next experiment
                System.GC.Collect();
                var window = EditorWindow.GetWindow <VFXViewWindow>();
                window.Close();
                VFXTestCommon.DeleteAllTemporaryGraph();

                for (int i = 0; i < 8; ++i)
                {
                    yield return(null);
                }
            }

            var report = new System.Text.StringBuilder();

            report.AppendFormat("ApplyChange : {0} - {1}", applyChanges, blocks ? "Blocks" : "Operators");
            report.AppendLine();
            foreach (var result in results)
            {
                report.AppendFormat("{0};{1}", result.Item1, result.Item2);
                report.AppendLine();
            }
            Debug.Log(report);
        }