NASA-AMMOS / NASA-AMMOS/3DTilesRendererJS

Use "requestIdleCallback" for tile processing

Open
#1,547 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.