Skip to content

Instantly share code, notes, and snippets.

@EngineerSmith
Created February 7, 2020 17:42
Show Gist options
  • Save EngineerSmith/61e59f8663b3b150244ce351cb9ee1a0 to your computer and use it in GitHub Desktop.
Save EngineerSmith/61e59f8663b3b150244ce351cb9ee1a0 to your computer and use it in GitHub Desktop.
local _profile = appleCake.profile("love.update")
local function bar()
local _profileBar = appleCake.profile("bar", {}) -- Initalizing args to an empty table as it's nil by default
--...
local _profileBarSet = appleCake.profile("bar set") -- Example of nested profiling
_profileBar.args.value = 12
_profileBarSet:stop() -- This could stop after _profileBar:stop() if you wanted
--...
_profileBar:stop()
end
local _profile --Example of reusing profiles to save creating garbage, recommended
local function foo()
_profile = appleCake.profile("foo", {num=5}, _profile) --("foo", nil, _profile), if you didn't have any args
--...
_profile.args["bar - 2"] = bar - 2
_profile:stop()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment