Can Certain Scripts Cause Lag

Can certain running scripts cause server or client side lag? Even if they do or don’t is script optimization even worth it?, is it a good way to reduce some lag or is it just a way to make the code easier to read or none of those?

3 Likes

Probably yes if it’s looped I think. or broken

2 Likes

Making a script easier to read probably won’t make it any more optimized, however it will help speed up debugging if you can find everything easier.

2 Likes

Client-side latency is primarily dependent on the machine, though yes you are capable of causing delays on the client through inefficient operations (and not necessarily loops alone, because not all loops cause any performance hits). It’s extremely dependent on what you’re doing, so a vague question isn’t enough here. A specific scenario is needed.

Optimisation is completely worth it if you aren’t going into microoptimisation without necessity. If you can shave off several seconds or tens of miliseconds worth operations, go right ahead. Inefficient code doesn’t necessarily cause lag but it can cause other kinds of performance problems.

Depending on how you go about it, optimisation can make code easier or more difficult to read. You generally want to aim to optimise while keeping your code readable for yourself.


@lnfinity_Stones

Loops don’t cause lag if the computations per iteration aren’t expensive. Broken code terminates the executing thread and stops it from running completely, so it obviously can’t cause lag issues.

4 Likes