wrapPerformWorkWithCoroutine unnessarially creates a thread each time its called
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- lua
- Domain
- performance
Research direction
Start in modules/scheduler/src/forks/SchedulerHostConfig.default.lua at wrapPerformWorkWithCoroutine() and performWorkUntilDeadline(). Measure the current thread creation and inspect how coroutine.yield(), xpcall, error handling, and yielding scheduledHostCallback interact. Done means avoiding unnecessary thread creation while preserving error handling and scheduler behavior.
Written by the indexing model from the issue text.
Description
Currently in the default host config for the scheduler, a new thread is made each time wrapPerformWorkWithCoroutine() is called.
When this is unnecessary given performWorkUntilDeadline() already uses xpcall and handles errors (not if ReactGlobals.__YOLO__ is disabled but that can be changed), and an inlined version could be used in wrapPerformWorkWithCoroutine() with coroutine.yield() replacing the use of error(), or alternatively dependency injection could be used for providing a function to be used like how error() is currently in performWorkUntilDeadline().
Thread Pooling would also then be used for wrapPerformWorkWithCoroutine() as to handle the cases where the scheduledHostCallback yields (fairly certain it can?).
I haven't tested the performance impact this makes, but I would expect it to not be insignificant given threads are one of the most heavy things memory wise and for the GC. Especially as the function returned by wrapPerformWorkWithCoroutine is called frequently as its part of the scheduler.
Edit: Will be testing eventually when I get the time
- Dominant language
- Luau
- Stars
- 568
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Roblox/react-luau
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Roblox/react-luau#36 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Roblox/react-luau#27 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Roblox/react-luau#22 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Roblox/react-luau#19 · 2 comments · 4 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Roblox/react-luau#18 ·
All issues in Roblox/react-luau
Similar issues
-
area/sessions comp/agent P2 tool/skills type/perf
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NousResearch/hermes-agent#117788 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
open-goal/jak-project#4424 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100