public IEnumerator RedoSame20TimesNoGCAllocsTest() { Voronoi.FlushPools(); Voronoi.InitPools(500, 500, 40, 200); var points = VoronoiTest.CreateRandomPoints(50); yield return(null); Voronoi voronoi = VoronoiTest.TestVoronoi(points); yield return(null); for (int i = 0; i < 20; i++) { Profiler.BeginSample("NoGC Voronoi.Redo same points"); voronoi.Redo(points, VoronoiTest.TestBounds()); Profiler.EndSample(); yield return(null); } Debug.Log(voronoi.DebugCapacities()); yield return(null); }
public IEnumerator RedoRandom20TimesWith3000PointsTest() { Voronoi.FlushPools(); Voronoi.InitPools(12500, 9000, 40, 11000); var points = VoronoiTest.CreateRandomPoints(3000); Voronoi voronoi = VoronoiTest.TestVoronoi(points); yield return(null); for (int i = 0; i < 20; i++) { points = VoronoiTest.CreateRandomPoints(3000); Profiler.BeginSample("NoGC Voronoi.Redo 20x3000 random points"); voronoi.Redo(points, VoronoiTest.TestBounds()); Profiler.EndSample(); yield return(null); } Debug.Log(voronoi.DebugCapacities()); yield return(null); }
public void _10000_Points_Test() { Voronoi.FlushPools(); var points = VoronoiTest.CreateRandomPoints(10000); var voronoi = VoronoiTest.TestVoronoi(points); Debug.Log(voronoi.DebugCapacities()); }
public IEnumerator AllocTest() { Profiler.BeginSample("Initing"); Random.InitState(10); var points = VoronoiTest.CreateRandomPoints(50); Voronoi voronoi = VoronoiTest.TestVoronoi(points); List <Edge> edges = voronoi.sites[0].Edges; List <bool> edgeOrientations = new List <bool>(edges.Count); Profiler.EndSample(); //var reorderedEdges = er.Edges; List <Edge> originalEdges = new List <Edge>(); originalEdges.AddRange(edges); yield return(null); Profiler.BeginSample("EdgeReorderer create"); EdgeReorderer.CreateInstance(); Profiler.EndSample(); yield return(null); Profiler.BeginSample("First EdgeReorderer reorder"); EdgeReorderer.Reorder(ref edges, ref edgeOrientations, typeof(Vertex)); Profiler.EndSample(); yield return(null); Profiler.BeginSample("NoGC EdgeReorderer reorder"); EdgeReorderer.Reorder(ref edges, ref edgeOrientations, typeof(Vertex)); Profiler.EndSample(); yield return(null); edges = new List <Edge>(); edges.AddRange(originalEdges); Profiler.BeginSample("NoGC EdgeReorder another reorder"); EdgeReorderer.Reorder(ref edges, ref edgeOrientations, typeof(Vertex)); Profiler.EndSample(); yield return(null); Assert.Greater(originalEdges.Count, 0); Assert.IsNotNull(edges); Assert.IsNotNull(originalEdges); Assert.AreEqual(edges.Count, originalEdges.Count); yield return(null); }