High Script Activity ~15%

I’m running a Localscript that does about ((14*(1+1+1))*200)*60 which equals to at least 504000 actions per second

if my math is right

For Every Instance do 1 CameraMethod, Get 14 CFrameVector3 and (1 Raycast + FindPartOnRayfor each CFrameVector3) at 60 times per second

  • 200 Instances
  • 60 times per second (using BindToRenderStep)
    • 1 CameraMethod
    • 14 CFrame*Vector3
      • 1 RayCast
      • 1 FindPartOnRay

The current Script Activity is about 7-15%, Rate is 100/s and ~58 FPS

It is concerning because I recall that you should keep it at below 3%

  • I wonder why that is the case because there is so much room above 3%, what is the 97% of it kept for?

  • Is it okay to have 100 scripts that has a Script Activity of 3% or all of them combined should be under 3%?

  • How does Script Activity work for Module Scripts?

What do you guys think?

1 Like

Raycasting, while more optimized than previous methods, will put a heavy load on your processing power, especially if you’re firing it that many times a second. I reccomend finding a solution that reduces it to maybe 10 times a second at most, rather than your 12,000.

1 Like

I should mention that I like messing around finding limits and boundaries of things and this is also an extreme case for what I’m using this code for, I would be doing all of that with ~800 actions or less per second when I replace the BindToRenderStep with a While Loop and remove 13 additional CFrame*Vector3s

Although your response solves my High Script Activity problem and is logical it doesn’t answer my questions of why it’s so important to keep Script Activity below 3%

Usually it’s advised to keep server scripts below 3%, as anything above that would cause the server to be sluggish and lag.

Client activity should be kept low to reduce memory usage and FPS drops.

2 Likes

Keeping your script activity low is important because it leaves more processing power for everything else, such as physics calculations and basic core functions such as the chat module. If your script activity is high, you’ll see these things start to slow down quite a bit.

So to sum it up, low script activity is better so we dont use up all the system resources on one script.

1 Like

I see, I thought there was more to the story because I did not expected the 100% to be shared with other things, I assumed that Scripts would have there own pool of processing power.

1 Like

I see, I have done some testing and I would assume that Script Activity has an impact on FPS.

Interestingly since my Script Activity was 7% I got about ~56 FPS or lost 7% of 60 which is 4

Observing further and I found out that with 90% Script Activity I lost 54 FPS and such, although Physics Calculations do have an impact too so this isn’t 100% accurate but is useful information.

2 Likes

% Really should be calculated by what’s available to use taking the backend like physics into consideration for resources. So we understand what % we can go to or use and have 0 impact.

4 Likes