local H=require("\080\097\116\104 \116\111 \098\105\110\097\114\121 \111\099\116\114\101\101")local A=require("\080\097\116\104 \116\111 \115\108\101\105\116\110\105\099\107\115 \109\111\100\117\108\101")local K=Vector3.zero.Dot local e=516 local f={}for H=1,1000,1 do table.insert(f,{Position=Vector3.new(math.random(-e,e),math.random(-e,e),math.random(-e,e))})end local B=workspace.StartPosition.Position local s=30 local function V()local H={}for A,K in f do local e=K.Position-B if e.Magnitude<=s then table.insert(H,K)end end return H end local r=H.new(e,5,Vector3.zero)H.InsertObjects(r,f)local v=A.new(516)local z={}for H,A in f do table.insert(z,v:CreateNode(A.Position,A))end return{ParameterGenerator=function()return end,Functions={["\067\114\101\097\116\105\110\103 \097\110\100 \105\110\115\101\114\116\105\110\103 \066\105\110\097\114\121\079\099\116\114\101\101"]=function(A)A.Begin("\067\114\101\097\116\105\110\103 \079\099\116\114\101\101")local K=H.new(516,10,Vector3.zero)A.End()A.Begin("\073\110\115\101\114\116\105\110\103")H.InsertObjects(K,f)A.End()end,["\083\108\101\105\116\110\105\099\107 \085\112\100\097\116\105\110\103 \110\111\100\101\115"]=function(H)for H,A in z do v:ChangeNodePosition(A,Vector3.new(math.random(-e,e),math.random(-e,e),math.random(-e,e)))end end}}
--!optimize 2

--[[
This file is for use by Benchmarker (https://boatbomber.itch.io/benchmarker)

|WARNING| THIS RUNS IN YOUR REAL ENVIRONMENT. |WARNING|
--]]

local BinaryOctreeModule = require("Path to binary octree")
--OldOctreeModule is a previous iteration of binaryoctree so its not included in this benchmark file as its not documented or saved on a github repo
--local OldOctreeModule = require(game.ReplicatedStorage.Shared.Octree)
local SleitnickModule = require("Path to sleitnicks module")

local Dot = Vector3.zero.Dot
local OctreeSize = 516

local Objects = {}

for i = 1,1000 do
	table.insert(Objects,{Position = Vector3.new(math.random(-OctreeSize,OctreeSize),math.random(-OctreeSize,OctreeSize),math.random(-OctreeSize,OctreeSize))})
end

local StartPosition = workspace.StartPosition.Position

local Radius = 30

local function LinearSearch()
	local GottenObjects = {}

	for _,Object in Objects do
		local SubtractedPosition = Object.Position - StartPosition
		if SubtractedPosition.Magnitude <= Radius then
			table.insert(GottenObjects,Object)
		end
	end

	return GottenObjects
end

local QueryOctree = BinaryOctreeModule.new(OctreeSize,5,Vector3.zero)
BinaryOctreeModule.InsertObjects(QueryOctree,Objects)


local SleitnickOctree = SleitnickModule.new(516)

local SleitNodes = {}

for _,Object in Objects do
	table.insert(SleitNodes,SleitnickOctree:CreateNode(Object.Position,Object))
end

return {
	ParameterGenerator = function()
		return
	end,

	Functions = {
		["Creating and inserting BinaryOctree"] = function(Profiler)
			Profiler.Begin("Creating Octree")
			local newOc = BinaryOctreeModule.new(516,10,Vector3.zero)
			Profiler.End()

			Profiler.Begin("Inserting")
			BinaryOctreeModule.InsertObjects(newOc,Objects)
			Profiler.End()
		end,
		["Sleitnick Updating nodes"] = function(Profiler)
			for _,Node in SleitNodes do
				SleitnickOctree:ChangeNodePosition(Node,Vector3.new(math.random(-OctreeSize,OctreeSize),math.random(-OctreeSize,OctreeSize),math.random(-OctreeSize,OctreeSize)))
			end
		end,
	},
}
