Edit: It’s live. debug.profilebegin(string label), debug.profileend()
Some tutorial videos:
Hey, so we’re working on a Lua performance profiling API.
You’ll be able to use this API to measure and visualize how long your Lua code takes, as well as figure out what is causing performance problems within your game.
This will be somewhat similar to Unity profiling, which is “annotation based” (You’ll need to add annotated sections to your code to see profiling data about it).
So we’ve got three possible ways this API could look:
You will need to manually match your profilebegin and profileend calls, or else your data will be invalid. You can nest multiple profilebegins within each other if you have the matching profileends.
local profileToken = debug.profilebegin(“test_section”)
You will need to manually match your profilebegin return token to your profileend call, or else your data will be invalid. You also won’t be able to close things out of order. Attempting to close something out of order will throw an error. The token parameter on close can be optional, and without it it would default to choice 1 behaviour.
Any yielding code will fail inside this block.
A couple of caveats with how this would all work.
- yielding or waiting functions would NOT work with this measurement.
- this function would only be useful for measuring the performance of your non-yielding, non-waiting lua code.
So, my question to you: Which one of these APIs would you prefer?
- Choice 1
- Choice 2
- Choice 3
- It doesn’t matter to me.
- I don’t know what this would be used for.
Added a mockup of what this would look like.