Created
February 7, 2020 17:42
-
-
Save EngineerSmith/61e59f8663b3b150244ce351cb9ee1a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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