Tracking Script Performance

What exactly would be the best way to test for script performance, preferably in a live server? I’ve tried the micro-profiler, but I can’t seem to figure out a lot from it or what scripts are doing what.

In one of my older games, the server seems to have lag spikes often enough to be of annoyance and I can’t seem to figure out what’s causing it.

Explanation of my issue:
  • There’s only one somewhat heavy process, but it only lasts a moment as it’s a search filter handled server-side (which I know isn’t smart. I was doing it to never display all data at once, but then I realized how irrelevant that is at a later date).

  • The day/night cycle is also handled server-side, which again should be done client-side, however I doubt that would be the issue anyway.

  • The only other server-side operations I can think of involve single short actions such as editing a decal’s texture property or rotating an object once per operation.

I think what makes this the most annoying is that the lag is incredibly inconsistent. As I’m playing now, there’s no lag whatsoever. But on other days, things will run slower and have random lag spikes.

But skipping to the point: Is there a way to track script performance during a live server in an understandable manner so I can track the culprit?

May not be an exact answer, but there is another way to monitor the performance other than the micro profiler:

In the developer console, click the “Scripts” tab:

It will then show you all the different scripts and what % of the activity they are making up. I recommend unticking the “Inactive” section:

If you watch it you will notice the activity % for some scripts go up a couple of percent. This couple of percent, while being small, is generally the cause of lag spikes

Example of a script causing a lag spike:

(up from 0.116%)

Also, I feel like adding things within scripts to track the performance would cause more harm than good, so maybe don’t do that :slight_smile:

1 Like

It’s a shame that it doesn’t seem to tell you the path of the script. I guess this means that I shouldn’t name half of my non-main scripts as just “Code”. It shows that the activity is usually 0%, but the rate is a bit alarming:

image

To be honest, Im still not entirely sure what the rate actually means. Generally the activity itself will show you what is going on though.

it could get a bit messy if they show the paths, but yeah, it can make it difficult. Try to get into the habit of giving all your scripts a relevent name so that debugging it becomes a lot easier!

1 Like