Whitelist more functions for Parallel Lua

As a Roblox developer, I’ve been working on multiple systems that could use quite a few more whitelisted functions that could potentially be thread-safe if looked into. Some of the hierarchies I’ve been working on and have been moving to be multi threaded include: server-side anti-cheat systems, hit box detection, rag doll systems, custom projectiles and global environment destruction. Since a large variety of functions aren’t currently marked as thread-safe I have to slow down tasks by constantly synchronizing and de-synchronizing them which defeats the point of performant and efficient multi-threading.

The following functions, at least to me, seem like they could potentially be multi-thread safe:

Model:GetExtentsSize (I use this a lot within the experiences I develop for)
Model:GetBoundingBox
BasePart:GetTouchingParts (I use this a lot within the experiences I develop for)
WorldRoot:ArePartsTouchingOthers

EDIT As of 5/31/2023 these functions have now been whitelisted: (Thank you whoever has been working on this)

PVInstance:GetPivot (EDIT: This has been whitelisted, last checked 5/31/2023)
Instance:GetActor (EDIT: This has been whitelisted, last checked 5/31/2023)
BasePart:GetNetworkOwner (EDIT: This has been whitelisted, last checked 5/31/2023)
BasePart:GetNetworkOwnershipAuto (EDIT: This has been whitelisted, last checked 5/31/2023)
BasePart:CanCollideWith (EDIT: This has been whitelisted, last checked 5/31/2023)
BasePart:GetVelocityAtPosition (EDIT: This has been whitelisted, last checked 5/31/2023)
Workspace:GetPhysicsThrottling (EDIT: This has been whitelisted, last checked 5/31/2023)
Workspace:GetNumAwakeParts (EDIT: This has been whitelisted, last checked 5/31/2023)
Workspace:GetServerTimeNow (EDIT: This has been whitelisted, last checked 5/31/2023)
Players:GetPlayerByUserId (This is not a web request) (EDIT: This has been whitelisted, last checked 5/31/2023)
Humanoid:GetStateEnabled (EDIT: This has been whitelisted, last checked 5/31/2023)
Humanoid:GetState (EDIT: This has been whitelisted, last checked 5/31/2023)
Player:GetNetworkPing (EDIT: This has been whitelisted, last checked 5/31/2023)

The use cases for most of these functions were listed at the top, such as, GetState, CanCollideWith and GetNetworkPing being used for a server-side anti cheat, ArePartsTouchingOthers for both hit box detection & anti cheat & environment destruction, GetNumAwakeParts and GetPhysicsThrottling for a projectile system and environment destruction (Custom version of throttling physics for BaseParts if the server physics is overloaded), GetNetworkOwner and GetVelocityAtPosition (Already had a similar thread: Allow GetVelocityAtPosition to be called in parallel ) for a rag doll system (Detecting if the client owns their own rag doll for server authoritative ownership of rag dolls and determining how far rag dolls should and have travelled) and so on. If at least some of these functions could be looked into being parallel safe, that would greatly help, even if all of them aren’t possible of being multi-thread safe.

15 Likes

I used TweenService:GetValue() in a parallel segment. I had to force it to run in serial because the method is not safe to use in parallel (though stuff is cached so it can still run in parallel most of the time).

I don’t see why that method would be unsafe to use in parallel