Server performance

Hi, I want to ask how you guys measure performance of your game. How should I know I my game have to much scripts or not optimized.

Thank you

You can use the microprofiler to see if there are any frames where your game dips below your target frame rate (usually 60 fps <=> 1 frame = 16.6 ms). If that happens you can pause it, and it’ll provide a breakdown of everything that happened during a frame and how long each step took (e.g. rendering, physics simulations, scripts, etc.). If you want to know what parts of your scripts are taking a long time in detail, you can use the profilebegin and profileend functions to make part of a script appear individually in the microprofiler, e.g. if you want to test if a specific for loop is too slow.

7 Likes

I used microprofiler and saw my lags that come:


but I dont know what is happening this

Sorry, misread your topic a bit. If you’re talking about performance only on the server, frame times are irrelevant because there’s no rendering going on anyway. You should still be able to see how long scripts, physics sim, etc. takes.

There’s no way to tell what is happening without looking more closely at the data, other than “occasional lag spikes happen, at regular intervals”. Switch into detailed mode:

image

You should get a view like this:

You can then zoom in on e.g. TSMk2 worker:

The entirety of Simulation takes up .23 ms, and is mostly made up of gameStepped and physicsStepped.

Adding a script that does a lot of work, you can get a view like this:

local s = ""
while wait(.5) do
	debug.profilebegin("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Dumb stuff")
	for i = 1, 100000 do
		s = tick() .. i
	end
	debug.profileend()
end

you’ll get a bar named after your script that takes like 50ms (on my PC):

For some reason I could only get custom profiling to work on LocalScripts??? No idea why.

2 Likes

Thank you, first I tought there I will see every script. Because I dont know where is problem. I fixed it right now by taking older version, unfortunately I didnt find what happened and where was problem. But your advices are super cool and big thank you once again for helping :slight_smile:

1 Like

No problem! If you figure out that a specific script is too slow and you don’t know why, feel free to make a separate topic and I’m sure someone will be able to help you figure it out :slight_smile:

1 Like

Problem is I didnt add any new script and this laggs occures. But now because of you I can measure my scripts which is really helpful