Skip to content

perf(world): optimize subtree bounds and retry throttling in placeOnHorizontalSurface - #805

Open
nsalminen wants to merge 1 commit into
mainfrom
perf/horizontal-placement
Open

nsalminen wants to merge 1 commit into
mainfrom
perf/horizontal-placement

Conversation

@nsalminen

Copy link
Copy Markdown
Collaborator

Description

Reduces main-thread CPU overhead during placeOnHorizontalSurface() candidate evaluation and blocked placement retries on XR devices:

  • Precollects visible subtree local bounding boxes once per frame (supporting custom .boundingBox renderables as well as Mesh geometries) and evaluates candidate transforms without repeated Box3.setFromObject() scene-subtree traversals.
  • Caches XRPlane polygon Vector2 arrays in a WeakMap keyed by lastChangedTime, and throttles unchanged retry sweeps to 250ms intervals (waking immediately when detected planes change) instead of re-running full obstacle/grid checks on every 72/90 Hz frame.
  • Raises the minimum placement distance cutoff from 0.5m to 0.75m with a soft comfort penalty inside 1.1m so large models aren't placed uncomfortably close to the headset.

Type of Change

  • Bug fix
  • New feature / enhancement
  • New demo or sample
  • Documentation update

Media / Screen Recordings & Screenshots (If Applicable)

  • Simulator Recording: N/A
  • Device Recording: N/A

Checklist

  • Tested in simulator & device: Verified functionality in desktop simulator and/or physical hardware (where applicable).
  • Large Assets ($\ge$ 1MB): Submitted separately to xrblocks/proprietary-assets via jsdelivr CDN.
  • SDK Dynamic Dependencies: All new SDK dependencies are dynamically loaded at runtime.
  • Security: Confirmed no hardcoded API keys or secrets are committed.

@nsalminen
nsalminen force-pushed the perf/horizontal-placement branch from e4b7688 to b7ea572 Compare November 16, 2026 19:26
@nsalminen
nsalminen force-pushed the perf/horizontal-placement branch from b7ea572 to 39721af Compare November 16, 2026 19:37
@nsalminen
nsalminen marked this pull request as ready for review November 16, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant