--[[
	MOD/lua_old/autorun/benchmarker.lua [#3648 (#3830), 684970588]
	Shinycow | STEAM_0:0:29257121 <76.100.140.68:27006> | [11.01.14 10:10:33PM]
	===BadFile===
]]

function BM_StringRep()
	local x = os.clock()
	local s = "fadsf"
	for i=1,100000 do string.rep(s, 1) end
	print("Elapsed time: " .. os.clock() - x)
end

	-- holy shit. 
	-- with just me (ran once):
		--Elapsed time: 0.057000000000698
		--Elapsed Time: 0.0039999999999054
	-- with 5 boths and me (ran once):
		-- Elapsed time: 0.11499999999978
		--Elapsed Time: 0.01299999999992
function BM_Pairs()
	local str = "fadfs"
	local x = os.clock()
	for i=1,300000 do
		for k,v in pairs(player.GetAll()) do
			s = v
		end
	end
	print("Elapsed time: " .. os.clock() - x)
	
	x = os.clock()
	for i=1,300000 do
		local next = next
		local playGetAll = player.GetAll()
		for k,v in next,playGetAll do
			s = v
		end
	end
	print("Elapsed Time 1: " .. os.clock() - x)
	
	x = os.clock()
	for i=1,300000 do
		local next = next
		local playerGetAll = player.GetAll
		for k,v in next,playerGetAll() do
			s = v
		end
	end
	print("Elapsed Time 2: " .. os.clock() - x)
	
	x = os.clock()
	for i=1,300000 do
		local plys = player.GetAll()
		local count = #plys
		local v
		for k=1,count do
			v = plys[ k ]
			s = v
		end
	end
	print("elapsed tIme 1: " .. os.clock() - x)
	
		-----
		----- both really slow. out of question.
		
	--[[x = os.clock()
	for i=1,400000 do
		local plys = player.GetAll
		local count = #plys()
		local v
		for k=1,count do
			v = plys()[ k ]
			s = v
		end
	end
	print("elapsed tIme 2: " .. os.clock() - x)
	
	x = os.clock()
	for i=1,400000 do
		local v
		for k=1,#player.GetAll() do
			v = player.GetAll()[ k ]
			s = v
		end
	end
	print("elapsed tIme 2: " .. os.clock() - x)]]
	
end

function BM_DivMul()
	local x = os.clock()
	local frags = 221
	local deaths = 26
	local answer = nil
	for i=1,100000000 do
		answer = math.Round(221 * ( 1 / 26 ), 2)
	end
	print("Elapsed time: " .. os.clock() - x)
	
	x = os.clock()
	answer = nil
	for i=1,100000000 do
		answer = math.Round(221 / 26, 2)
	end
	print("Elapsed time: " .. os.clock() - x)
end

function BM_TableInsert()
	local x = os.clock()
	local tablein = {}
	local str = "fdddddddddddddddsaaaaaaaaaa9124mZoPQZ"
	for i=1,1000000 do
		table.insert(tablein, str)
	end
	print("table insert Time: " .. os.clock() - x)
	
	x = os.clock()
	tablein = {}
	for i=1,1000000 do
		tablein[ #tablein + 1 ] = str
	end
	print("#tablein + 1 Time: " .. os.clock() - x)
end

function BM_PlayerGetAll()
	local x = os.clock()
	local s = "fdasd"
	for i=1,100000 do
		for k,v in pairs(player.GetAll()) do
			s = v
		end
	end
	print("player.GetAll Time: " .. os.clock() - x)
	
	x = os.clock()
	for i=1,100000 do
		for i=1,#player.GetAll() do
			s = player.GetAll()[ i ]
		end
	end
	print("#player.GetAll() Time: " .. os.clock() - x)
	
	x = os.clock()
	for i=1,100000 do
		for i=1,#player.GetAll() do
			local v = player.GetAll()[ i ]
			s = v
		end
	end
	print("#player.GetAll()local Time: " .. os.clock() - x)
	
	x = os.clock()
	for i=1,100000 do
		local playerGetAll = player.GetAll
		for k,v in pairs(playerGetAll()) do
			s = v
		end
	end
	print("outside loop local player Time: " .. os.clock() - x)
	
	x = os.clock()
	for i=1,100000 do
		local playerGetAll = player.GetAll
		for i=1,#playerGetAll() do
			s = playerGetAll()[ i ]
		end
	end
	print("one more playerGetAll Time: " .. os.clock() - x)
end

function BM_Explode()
	local s = "fdasd hi my name is ShinycoW!!1 !! 1 lol XDxd"

	local x = os.clock()
	for i=1,200000 do
		string.Explode( " ", s )
	end
	print("StringExplode Time: " .. os.clock() - x)
end

function BM_Split()
	local s = "fdasd hi my name is ShinycoW!!1 !! 1 lol XDxd"
	
	local x = os.clock()
	for i=1,200000 do
		string.Split( s, " " )
	end
	print("StringSplit Time: " .. os.clock() - x)
end