Full Release of Parallel Luau V1

Something important to note is that the main thread will help run code that executes in actors, but it won’t be the only one. Unless you only have two actors in your example, you likely have more threads shown by the microprofiler that also help execute the same function in a different actor. It’s common to see multiple actors as part of the same task, when the number of actors is larger than the number of cores (which it should be!)


I only use parallel Luau for my rigged-mesh ocean for my whole game, and the thread always waits for all actors to finish running before proceeding. That’s why I’m confused if the code actually is running in parallel, since I can’t get it to work.


Yeah, the actors must finish executing the code they currently run before the rest of the frame may proceed. But during this section of the frame they run in parallel wrt each other, which means you can process much larger volumes of data faster.

So you’d expect something like this:

Unfortunately there are some visualization bugs in microprofiler under heavily threaded usage that may make it difficult to confirm this, but my larger point is that unless you only use two Actors, then in your screenshot you must have other threads that during the same region of time execute the rest of the work.


Sorry if I’m not thoroughly understanding then, but is my code actually running in parallel in this case? Since I’m still unsure how to 100% verify this behavior, as I was unable to find any other parallel-threads in the microprofiler - here’s the last 64 frames dumped (ocean-related labels are under Worker:runJobWaitingHybridScriptsJob):
microprofile-20220622-021901.html (6.8 MB)

It does indeed look as if they are running serially. Are you only using a single Actor? Note that multiple scripts in a single Actor will execute serially, the unit of the parallelism is the Actor - not a Script.

1 Like

I’m using the same Parallel module as was posted here: Full Release of Parallel Luau V1 - #44 by PysephDEV
The module seems to be working as expected, too:

1 Like

I made a quick test place and I appear to be having a similar problem. I created three actors each with a single simple script:

In the microprofiler they all appear to be running serially:

microprofile-20220621-162131.html (2.6 MB)

Am I missing something?

EDIT: Turns out my task.wait() was resyncing the script, desyncing inside the loop fixed it :+1:


Perhaps console functions like print and warn don’t support multithreading? Try replacing the warn() with some other demanding operation.

task.wait() returns the thread to serial.

1 Like

Ohhh I just assumed for some reason that task.wait() desynchronized again after but that makes sense. Calling task.desynchronize() in the loop fixed it. Thanks!


Thank you thank you thank you! This is gonna superboost performance for any of my games, and it will make it possible to have more AI active at once without ruining the server! WOOHOOOOP

Xeon are processors designed more for servers and long lasting not User computers, Maybe try an core i9 if you are looking for the highest or i7 as for AMD I dont know but their prices are cheaper.

May I ask how will the actor work in a more understandable way?

Would you mind sharing a complete example (.rbxl) that demonstrates the problem? We can then pinpoint what exactly is going wrong here.


Sure thing! I’ll send a PM with the repro file.

Can workspace:GetRealPhysicsFPS() be in parrallel?

I seriously want to use this for a physics fps counter, unless im using it wrong.

you can’t its not thread safe. You can see if a function is thread safe by looking at the docs and seeing the thread unsafe notice.

I know, But will there ever be a time where this will be safe? This isnt modifying anything to not be in parallel to my knowledge.


I think theres a lot issues with it running in an unsynced thread. So I doubt it.

Just make the thread synced to read, then unsynced again.

1 Like

For games that use modular frameworks being required by a single script on each client and server, does that mean that parallel lua is completely useless for now? My game is heavily component-based so the concept of multiple actors makes sense but if the component framework is initialized from a single script, doesn’t that mean the script would be under a single actor and thus parallel execution wouldn’t occur for multiple components?