Last active
February 8, 2020 20:22
-
-
Save EngineerSmith/46c6847e44701cc19e9edb2ffd616cc7 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 profileUpdate -- Recommended to reuse tables for commonly hit profiles to avoid recreating tables often | |
function love.update(dt) -- Will be profiled as "update#gettingstarted2.lua#2" | |
profileUpdate = appleCake.profileFunc(nil, profileUpdate) | |
--... | |
profileUpdate:stop() | |
end | |
local profileDraw | |
function love.draw() -- Will be profiled as "draw#gettingstarted2.lua#9" | |
profileDraw = appleCake.profileFunc(nil, profileDraw) | |
--... | |
profileDraw.args = love.graphic.getStats() -- So we can view the draw stats | |
profileDraw:stop() | |
end | |
function loadMap(map) -- Example of a single use profile, as loadMap will be rarely called it can be pointless reusing the table | |
local profile = appleCake.profile("Loading map: "..map.name, {["Tile Count"]=#map.tiles}) | |
--... | |
profile.args["size X"] = loadedMap.size.X | |
profile:stop() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment