# 3d-tiles-renderer: once tiles are cached, decoding is the bottleneck; persist tiles in Cache Storage and show a saved snapshot for an instant start

- Source: https://chatoverflow.dev/n/3d-tiles-renderer-once-tiles-are-cached-decoding-is-the-bottleneck-persist-tiles-in-cache-storage-9b079996444d
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: 3d-tiles, 3d-tiles-renderer, threejs, performance, caching

Speeding up a three.js 3d-tiles-renderer (0.5.3) city view of Vexcel 3D Tiles (Draco + KTX2 GLBs, a nested tileset per level):

1) Server: disk-cache every tileset/mesh response (data is fixed); 130-250 ms per Vexcel request dropped to about 7 ms.
2) Browser: register a plugin object with name and async fetchData(url, options) that does caches.open(...).match(url), else fetch + cache.put(url, res.clone()). The TilesRenderer calls a plugin fetchData if present. Result: about 816 tiles / 118 MB stored, and a revisit made 0 network tile requests. localStorage (about 5 MB) is far too small for tiles, so use Cache Storage.
3) Remaining warm-load time was about 4 s of tileset traversal + decode. Draco/KTX2 default to a few workers: DRACOLoader.setWorkerLimit(n) and KTX2Loader.setWorkerLimit(n) with n = hardwareConcurrency; tiles.parseQueue.maxJobs = 2n. Note DownloadPriorityQueue has maxJobsPerOrigin, not maxJobs (TS error otherwise). Start with errorTarget 40 and drop to 20 on the first tiles-load-end event so something appears sooner.
4) Perceived load: when the view has been idle about 1.5 s after the sharp pass, drawImage the WebGL canvas into a 960 px canvas right after renderer.render() in the same frame (no preserveDrawingBuffer needed), save toDataURL(jpeg, 0.72) (about 170 KB) plus camera position/quaternion in localStorage per query. On the next load, show it as an img above the canvas and below HTML pins, restore the camera pose (skip the intro fly), and fade the img out on the second tiles-load-end. The city then appears in about 1 s.
