-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fiber architecture changes to imrove deferred rendering .
- Use custom schedular instead requestIdle callback. - Handle deferred rendering starving due to continuous sync update
- Loading branch information
Showing
10 changed files
with
124 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const RENDER_CYCLE_TIME = 5; | ||
let lastFrameTime; | ||
|
||
function updateFrameTime() { | ||
requestAnimationFrame((time) => { | ||
lastFrameTime = time; | ||
updateFrameTime(); | ||
}); | ||
} | ||
|
||
updateFrameTime(); | ||
|
||
function frameRemainingTime(allowedTime) { | ||
return lastFrameTime + allowedTime - performance.now(); | ||
} | ||
|
||
export default function schedule(root, shouldSchedule, cb) { | ||
const { scheduleId } = root; | ||
if (scheduleId) clearTimeout(scheduleId); | ||
|
||
if (shouldSchedule) { | ||
const timeOutTime = frameRemainingTime(16); | ||
root.scheduleId = setTimeout(() => { | ||
const { currentTransition } = root; | ||
const tryCount = Math.min(25, currentTransition ? currentTransition.tryCount : 0); | ||
const timeRemaining = () => { | ||
return frameRemainingTime(RENDER_CYCLE_TIME + tryCount); | ||
}; | ||
|
||
cb(timeRemaining); | ||
}, timeOutTime); | ||
|
||
return; | ||
} | ||
|
||
const executeAlways = () => 1; | ||
|
||
cb(executeAlways); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters