From e99ae1136be03729b8c265020934844e1c586f5f Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 4 Aug 2024 21:51:48 -0500 Subject: [PATCH] perf: less particle systems --- app/react/components/particle-worker.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/react/components/particle-worker.js b/app/react/components/particle-worker.js index 76f9c41..90822ea 100644 --- a/app/react/components/particle-worker.js +++ b/app/react/components/particle-worker.js @@ -4,6 +4,17 @@ import createEcs from '@/server/create/ecs.js'; import ClientEcs from './client-ecs.js'; const ecs = createEcs(ClientEcs); + +[ + 'ClampPositions', + 'Colliders', + 'MaintainColliderHash', + 'VisibleAabbs', +] + .forEach((system) => { + ecs.system(system).active = false; + }) + ecs.$$caret = Math.pow(2, 31); const emitter = new Emitter(ecs); @@ -30,7 +41,7 @@ function tick(now) { ecs.tick(elapsed); emitter.tick(elapsed); const update = {}; - const lastNearby = new Set(memory.values()); + const lastNearby = new Set(memory); for (const id in ecs.$$entities) { const entity = ecs.$$entities[id]; if (ecs.$$detached.has(entity.id)) {