public void InsertTriggerDivideBulk() { var values = GetValues(); var elements = new NativeArray <OctElement <int> >(values.Length, Allocator.TempJob); for (int i = 0; i < values.Length; i++) { elements[i] = new OctElement <int> { pos = values[i], element = i }; } var job = new OctreeJobs.AddBulkJob <int> { Elements = elements, Octree = new NativeOctree <int>(Bounds) }; var s = Stopwatch.StartNew(); job.Run(); s.Stop(); Debug.Log(s.Elapsed.TotalMilliseconds); OctreeDrawer.Draw(job.Octree); job.Octree.Dispose(); elements.Dispose(); }
public void InsertTriggerDivideNonBurstBulk() { var values = GetValues(); var positions = new NativeArray <float3>(values.Length, Allocator.TempJob); var octree = new NativeOctree <int>(Bounds); positions.CopyFrom(values); NativeArray <OctElement <int> > elements = new NativeArray <OctElement <int> >(positions.Length, Allocator.Temp); for (int i = 0; i < positions.Length; i++) { elements[i] = new OctElement <int> { pos = positions[i], element = i }; } var s = Stopwatch.StartNew(); octree.ClearAndBulkInsert(elements); s.Stop(); Debug.Log(s.Elapsed.TotalMilliseconds); OctreeDrawer.Draw(octree); octree.Dispose(); positions.Dispose(); }