mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
Add yield intervals for diffing and hydrating processes
- Introduced `DIFF_YIELD_INTERVAL` and `HYDRATE_YIELD_INTERVAL` constants to manage execution pacing during the diffing and hydrating processes, respectively. - Implemented logic to pause execution every specified interval to improve performance and prevent potential blocking in long-running operations. - Enhanced the `diff` and `hydrate` functions to track and yield based on their respective counts, ensuring smoother operation during intensive tasks. These changes aim to enhance the responsiveness of the system during heavy processing tasks by introducing controlled yielding mechanisms.
This commit is contained in:
parent
b85c5f5ec7
commit
354d4c8b21
2 changed files with 18 additions and 0 deletions
|
|
@ -13,11 +13,21 @@ local Log = require(Packages.Log)
|
|||
local invariant = require(script.Parent.Parent.invariant)
|
||||
local Matching = require(script.Parent.matching)
|
||||
|
||||
local HYDRATE_YIELD_INTERVAL = 1000
|
||||
|
||||
local function hydrate(instanceMap, virtualInstances, rootId, rootInstance, session)
|
||||
if not session then
|
||||
session = Matching.newSession()
|
||||
end
|
||||
|
||||
if not session.hydrateCount then
|
||||
session.hydrateCount = 0
|
||||
end
|
||||
session.hydrateCount += 1
|
||||
if session.hydrateCount % HYDRATE_YIELD_INTERVAL == 0 then
|
||||
task.wait()
|
||||
end
|
||||
|
||||
local virtualInstance = virtualInstances[rootId]
|
||||
|
||||
if virtualInstance == nil then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue