ScriptProfiler [Beta]

Hi Developers,

We are excited to announce that we’re releasing a public beta of ScriptProfiler on Studio.

This is a new sampling profiler available as a tab within DevConsole. While running, this profiler records the entire call stack of all executing scripts with a sampling frequency of 1000 times per second.

To enable this beta feature, go to File → Beta Features, and select “Script Profiler”, then click Save, and restart Studio.

Using ScriptProfiler

Open DevConsole and navigate to the ScriptProfiler tab. Click the Start button to begin the profiling session. Click the button again to end profiling and display profiling data.

Profiling data is organized by top-level categories. Some categories correspond with specific sections of each of frame: Parallel Luau, WaitingScripts delayed threads, deferred threads, etc… Other categories correspond to events, such as RenderStepped.

By default, time spent in each node is represented as milliseconds of CPU time. Click Unit to toggle displaying time spent as percentages of the total recording session.

ScriptProfiler supports manually-specified profiler regions via debug.profilebegin() and debug.profileend().

Hover your cursor over a node in the call-tree to view file and line information.

Switching to the Server tab enables profiling scripts running on the server. It is possible to profile both client-side and server-side simultaneously by switching between Client and Server. There may be a small delay between stopping the profiling session and updating the displayed profiling data.

Additional Notes

Currently, starting and stopping the profiler again will not reset the profiling data, instead, new profiling data will be aggregated with previously collected data.

While the profiler supports sampling Luau functions, and Roblox instance method calls and property access, time spent in standard library calls, or accessing primitive types, such as CFrame, will be attributed to the calling function.

Due to the nature of sampling, profiling data will be noisy for functions that don’t significantly contribute.

Threads that sleep, or wait, for results do not contribute to the overall time displayed by the profiler since they don’t consume CPU resources.

The profiling session initiated on a server is shared. The session will start when at least one user has started server-side profiling and will end when all users that have started server-side profiling on the same server have stopped profiling. This means that if a second user starts profiling while the profiler is already running on the server, the second user may receive profiling data that had been collected before they had started profiling.

Feedback

We are planning to release enhancements to this tool in the future. Feel free to suggest improvements, and report issues, in the thread below.

Thanks to @WallsAreForClimbing, @zeuxcg, and @machinamentum for working on this!

174 Likes

This topic was automatically opened after 10 minutes.

This is super neat, this is something I’ve WANTED FOR SO LONG and had to resort to external resources for - will immensely help debugging scripts that impact performance of our project.

13 Likes

This is an actually amazing update. This lowers the skill to entry for debugging performance, and it’s going to make my life a lot easier. This also makes it way easier to debug performance issues without constantly needing to open up HTML files in Roblox’s logs.

Awesome update!

7 Likes

Had to comment each part in the code before. to debug which part impacts performance network-wise

Hey, this is looking awesome! I’ve been wanting this tooling for a while now.

Is there any chance we can get Lua heap memory analysis too? It’s been hard to track down where memory usage is coming from, and the tooling here mostly comes down to guessing.

31 Likes

LETS ACTUALLY GOOOOOOOOOOOOOOOOO!!! This is a completely epic update, as a bunch of my games have suffered severe lag from scripts at times and this will help the debugging process to an extreme degree.

3 Likes

THANK YOU ROBLOX. Finally, I can find exactly what scripts are lagging my game instead of having to guess based on what the “Memory” tab tells me. Thank you.

2 Likes

Great! Now I won’t have to look at the “messy” and confusing MicroProfiler for this. Not gonna lie, I actually never found my profiles in it so I just removed the debug.profilebegin calls.

Thank you, I will be adding some profiles to track my scripts once this gets released.

2 Likes

Man, what a day to be alive!!!

1 Like

Very clean and exactly what I needed, thank you! Keep up the updates!!!

1 Like

YOU ARE SO AMAZING ROBLOX

2 Likes

Is there any way to export the data collected by this tool like with the microprofiler? If not, this would be a great addition!


I’m also curious if CoreScripts and (in studio) plugins are included. The number and size of CoreScripts and luau content built into the engine has grown drastically, and sometimes they have difficult to identify and report performance issues.

3 Likes

wow a new feature for the cool developers console

Heavily agree on this, a more in depth way to see where memory is being used would be great, as currently if you have a data leak, it is really a random process to find out what is causing the leak.

Wow! This is truly amazing and better time management since now we can easily locate & resolve all of our issues!

Pretty great to see that ease of use for developers is improving.

This looks really useful, but I’m confused on what it’s actually helping to debug? I’m not that familar with the Microprofiler either-

2 Likes

This is going to be really beneficial, makes it was more efficient. Thanks, Roblox :+1:

Thank you roblox! Excited to use this