mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
perf(globe): less churn in movers and lines
Review of Tasks 2–3: - the mover store's instance checks no longer build arrays or closures per set() (orientation and colour checked field by field), and dirty() returns one reused range object; - Cesium models get their matrix and colour through scratch objects (Model.modelMatrix and Model.color copy what they are given) instead of a new Matrix4 and Color per placement; - a destroyed MoverSet releases its store (count 0, empty instance arrays, no pick ids) so a set object a layer still holds keeps no memory, and the Cesium parts drop their billboard, point and model lists; - (with the overlay commit) the Navara line viewport is updated in place. Node micro-measure, 10 000 instances set + packed per frame: 0.27-0.29 ms, about 1.7 KB per frame (0.17 B per instance), as before. Contract: Cesium 70/70, Navara 76/76.
This commit is contained in:
1 parent
d483e5897e
commit
39d522c9a9
3 files changed
+84
-17
No files matched your search
@@ -170,7 +170,7 @@ test('the set facade forwards to the store and an engine commit, once destroyed
|
||||
);
|
||||
const calls = [];
|
||||
const set = createMoverSet(store, {
|
||||
commit: () => calls.push(['commit', store.dirty()]),
|
||||
commit: () => calls.push(['commit', { ...store.dirty() }]),
|
||||
destroy: () => calls.push(['destroy']),
|
||||
});
|
||||
set.set(0, { position: { x: 1, y: 2, z: 3 } });
|
||||
@@ -187,3 +187,23 @@ test('the set facade forwards to the store and an engine commit, once destroyed
|
||||
assert.throws(() => set.set(0, {}), /destroyed/);
|
||||
assert.throws(() => set.commit(), /destroyed/);
|
||||
});
|
||||
|
||||
test('a destroyed set releases its instance arrays', () => {
|
||||
const store = createMoverStore(
|
||||
normalizeMoverSetOptions({
|
||||
id: 'r',
|
||||
kind: 'point',
|
||||
capacity: 1000,
|
||||
point: { sizePx: 2 },
|
||||
}),
|
||||
);
|
||||
const set = createMoverSet(store, { commit() {}, destroy() {} });
|
||||
set.set(0, { position: { x: 1, y: 2, z: 3 }, pickId: 'p' });
|
||||
set.setCount(1);
|
||||
set.destroy();
|
||||
assert.equal(store.count, 0);
|
||||
assert.equal(store.positions.length, 0);
|
||||
assert.equal(store.pickIds.length, 0);
|
||||
assert.equal(set.positionsView().length, 0);
|
||||
assert.equal(store.dirty(), null);
|
||||
});
|
||||
Reference in new issue
Block a user