[Parallel Luau] Is it possible to detect worker count or is it hardcoded to 3?

First time using Parallel Luau, I implemented it to help speed up some background computations for an effect I was making, and I’ve got a bit of a situation here.

The work I’m performing can be pretty heavy and I want to make it the least impactful as possible while it’s running (even though it won’t happen randomly to disturb), and if I try to use more Actors than there are workers active on the client, the performance impact is worse because some workers may have to run two or more tasks on one frame.
If I perfectly match the worker count, every worker only does one computation task per frame and the overall performance impact is less.

So, can I check how many workers are active through some function, or is it always hardcoded to 3 in Roblox Player? I noticed that weird arbitrary limit when jumping from Studio to Player.
If it’s not hardcoded, having a way to check the worker count would be preferable as opposed to some in-game setting that controls the thread count.

Here’s an example with my original thread count of 8, where one worker ends up managing two tasks and the other two manage three tasks, delaying the next frame more than usual.

I don’t work with Parallel Luau very often, but from my experience, I haven’t encountered any API that adjusts the number of CPU workers or detects the amount the client has.

You can’t.
Its CPU dependent.
So yeah no ways to detect it sadly.

1 Like

Maybe not really CPU dependent as it’s a weird limit of 3 when Studio can use way more workers, but I’ll assume it’s always set to use 3 workers in Player and have that as my game’s default Actor count for background activity.

1 Like

TLDR: They purposefully limited it because using more than 3 cores ended up tearing the OS’s thread scheduler and made the performance unpredictable.

Yes, this makes Parallel Luau nearly useless.

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.