Hey Programmers.. what matters more?

Hey scripters. when it comes to good programming what do you think is better, script speed or script optimization.

I’ve been working on a project for a few days, and I want to know what I should move towards in my programming.

In my opinion I think speed but I will be grateful to hear any of your opinions with valid facts so that I know what to move more into.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

1 Like

Speed comes with good programming.

Don’t bother with micro-optimizations (unless you absolutely have to). You won’t need it 99.9% of the time.

Functionality & Readability > everything else.


so what can i do to make my scripts run faster?

I tend to write the functionality of the script first. Once completed, I will go through and look for the optimisations, such as repeated code turned in to a function, ensuring connections get Disconnected when not required or common code turned into modules.

Once that is done, I will look at speed (F9 > Scripts) and check if anything is awry.


Scripts already run very fast (especially with Luau optimizations). You don’t need it to be any faster. There is no secret trick.

Avoid deprecated APIs and program as you would normally.

A use case for optimization is if you are running very heavy calculations every frame, in which case it would be down to using a different algorithm, work with parallel operations, etc.

Edit: The main bottleneck for most people would be sending data over the network via remotes. If you are trying to send a large amount of data multiple times every second, there are posts out there that specializes in compressing and decompressing data.

what is the speed you are normally looking for in f9?

You can start by using the task library if you aren’t already.

I use that already I used a benchmarker and noticed it was faster than the coroutine library

I have read that Activity (%) should be below 1.0 and Rate (/s) should be ~60 if an event is firing every frame roughly. It’s when you see insanely high numbers in there that you know that something is fundamentally wrong with your script(s).

For example, I had a script cloned to a projectile every time one was fired. The Rate (/s) started to climb the more projectiles fired, until it got to silly numbers, making me look more closely at the script. It was then that I realised that the projectile was not being cleanly destroyed and the script was still runnng it’s raycast and cframe updates every heartbeat.

I suppose it depends on what you define as ‘script speed’. If you’re referring to the speed at which a script runs, then it’s no different to saying how optimised your scripts are. If you’re referring to the speed at which you can write a script, my opinion is no different to what @UIScript has stated:

You should only write scripts as fast as you can comply with programming principles. It’s a good thing to write scripts extremely quickly, but what use would the script be if it’s unreadable and/or causes problems in the future all due to avoiding principles such as for loops and comments. Ensuring that a script is robust and written carefully can also help to decrease the amount of work needed to optimise it, and therefore, I personally think that script writing speed matters more.


What truly matters is that you actually ship the product, because how are your players are suppose to play the game if you never ship it, or its updates. I know some people who ship their product way overdue, or they never do it, because they are always trying to solve a problem that doesn’t exist. For example, they might be trying to:

  • Optimize code that already runs fine
  • Rewrite code that already does what it needs to do
  • Modularize code that doesn’t need to be modularized

Focus on functionality, and readability. If it runs fine and works as intended, then test and ship it, don’t do more work than necessary to get the job done.

1 Like

As a side conversation, when Luau came out with typechecking, I put off learning how to actually use it, but when I actually sat down and spent days mastering typechecking, my development speed skyrocketed as I would have fewer, and even sometimes no mistakes, after writing a large piece of code.

Although it may seem a bit contradictary to faster writing speed, I now define everything with a type, even if it’s implied. It is extremely nice to know while programming what you are getting, setting, or returning wrong and have to spend less time playtesting over and over again.

Once again, it seems no one in the thread as mentioned how useful programming principles are and only go by the conventional standards that just feel right. There are good keywords like DRY or “don’t repeat yourself” and on the far side, there are things you would call an architecture.

1 Like