static PerformanceResult RunTestForGraph(WorldGraph graph)
        {
            var       result = new PerformanceResult();
            Stopwatch sw     = new Stopwatch();

            result.name = graph.name;

            sw.Start();
            graph.ProcessOnce();
            sw.Stop();
            result.processOnceTime = sw.Elapsed.TotalMilliseconds;

            sw.Reset();
            sw.Start();

            graph.Process();

            sw.Stop();
            result.processTime = sw.Elapsed.TotalMilliseconds;

            result.nodeProcessTime = new NodeProcessTime[graph.allNodes.Count()];
            for (int i = 0; i < result.nodeProcessTime.Length; i++)
            {
                var node = graph.allNodes.ElementAt(i);
                result.nodeProcessTime[i] = new NodeProcessTime(node.name, node.processTime);
            }

            result.totalAllocatedMemory      = Profiler.GetTotalAllocatedMemoryLong();
            result.totalReservedMemory       = Profiler.GetTotalReservedMemoryLong();
            result.totalUnusedReservedMemory = Profiler.GetTotalUnusedReservedMemoryLong();

            return(result);
        }
        void InitGraph(WorldGraph graphAsset)
        {
            this.graphAsset = graphAsset;
            this.graph      = graphAsset.Clone() as WorldGraph;

            graph.SetRealMode(true);
            chunkSize = graph.chunkSize;

            if (terrainRoot == null)
            {
                UpdateTerrainRoot();
            }

            graph.UpdateComputeOrder();
            graph.ProcessOnce();

            UpdateChunks(true);
        }