local function ProfileBegin(Mame, IsOn)
if IsOn then
debug.profilebegin(Name)
end
end
local function ProfileEnd(IsOn)
if IsOn then
debug.profileend()
end
end
ProfileBegin("", IsDegub)
ProfileEnd( IsDegub)
ProfileBegin("", IsDegub)
ProfileEnd( IsDegub)
ProfileBegin("", IsDegub)
ProfileEnd( IsDegub)
ProfileBegin("", IsDegub)
ProfileEnd( IsDegub)
Or like this?
if IsDebug then
debug.profilebegin("")
debug.profileend()
end
if IsDebug then
debug.profilebegin("")
debug.profileend()
end
if IsDebug then
debug.profilebegin("")
debug.profileend()
end
if IsDebug then
debug.profilebegin("")
debug.profileend()
end
If designed correctly, leaving the debug calls in production shouldn’t cause any issues. But if you really only want to toggle it on/off, I feel like your first example with the function wrapping is a bit easier to manage and read without creating too much jargon into your code.
I am not sure of how much specifically, but it is recommended to not leave out many debug profiling or some labels will appear as systematic texts which is hard to find / understand, since micro profilers have limited budgets.
I decided scrap the micproprofiler debugging all torgether due to it adding complexity to my code no mater what and not really appearing that usefull to me because I track exec time with os.clock() to track the used time and approximate lengths of code execution by commenting out certain code.
But I might reimplement them if they appear necessary. I might use them for some debugging but at the time they don’t appear too usefull.
Also I am planning to release the code publicly and I came up with the conclusion that the profiler statements would only confuse people.