NASA-AMMOS / NASA-AMMOS/3DTilesRendererJS
Use "requestIdleCallback" for tile processing
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.5k
- Forks
- 416
- Avg merge
- 17h 52m
- Merged PRs (30d)
- 37
Description
Related to #1407
Some tasks are time-sliced over multiple frames to split up the work and keep the frame rate up:
- PriorityQueue
- Tiling content downloading, parsing, preprocessing
- Image overlay processing
- QueryManager
- Time slice point settling per frame
- LRUCache
- Used for unloading TilesRendererBase tiles
- Used for unloading data in UnloadTilesPlugin
This work could be more quickly completed if we allow for it to run in an idle callback for a fixed amount of time. This would require adjusting PriorityQueue and LRUCache to be able to run for a fixed amount of time in addition to optionally iterating over a fixed amount of items (timing can possibly default to Infinity?) so we can take advantage of idle time. One caveat is that it's not supported in Safari:
requestIdleCallback( idle => {
// run for the provided idle time
const runTime = idle.timeRemaining();
queue.tryRunJobs( runTime );
// schedule idle callback again until work is complete?
} );
Perhaps a utility function can be written that can schedule frame work in addition to idle callback? This can't replace the rAF because we still need a guaranteed processing on the next frame.
Contributor guide
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.
Research direction
Start by tracing the time-slicing entry points in PriorityQueue, LRUCache, and QueryManager, then read related issue #1407. Determine how idle callbacks could bound work while preserving guaranteed next-frame processing and Safari compatibility. Done means the listed workloads can use idle time without replacing the existing requestAnimationFrame path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100