Moving transit allocates nothing per frame: reusable positions, kept lists, and the frame probe back in testing.js

- Scratch and marker positions are a Cesium-free Vec3 (src/geo/vector.js), so writing a coordinate does not allocate.
- The dirty set and the upsert lists are kept between frames instead of rebuilt; patchDrawnIcons reuses its lookup arrays.
- measureFrames and stopFrameProbe live in src/layers/transit/testing.js again.
- Tests: 3000 moving vehicles stay under 8 KiB per frame of layer allocation; moving 500 icons allocates under 256 B per upsert.
This commit is contained in:
Sameh Khamis committed 2026-11-15 18:27:10 -08:00
1 parent 0ab31d4fb8
commit 725f2f2998
7 files changed
+359 -138

No files matched your search

+3 -2
View File
@@ -1,4 +1,5 @@
import { createHistoryBudget } from '../../data/contactPlayback.js';
import { Vec3 } from '../../geo/vector.js';
import { worldTimeFor } from '../../time/worldClock.js';
/**
@@ -134,8 +135,8 @@ export function createState({ services }) {
state._limitWarned = false;
// Where `samplePosition` writes a marker's position, each frame, before
// it is copied into the marker.
state._scratchCartesian = { x: 0, y: 0, z: 0 };
// it is copied into the marker: a `Vec3`, so the write allocates nothing.
state._scratchCartesian = new Vec3();
return state;
}