[OPT] effects.js: rain update loops all particles every frame — consider frustum culling #34
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: LOW (future optimization)
File:
js/effects.jslines 77-89Problem
updateEffects()iterates every rain particle every frame to update positions. At 2000 particles (high tier) this is 2000 iterations × 60fps = 120K iterations/second. The loop itself is lightweight (just position math), but on low-end devices it adds up.The starfield particles are static but still rendered every frame even though they never move.
Suggested Optimization
frustumCulled = true(default) and set a proper bounding sphere so Three.js can skip it when out of viewFixed in PR #37 (QA Sprint v2).
Implemented in PR #59.
Pre-computed bounding spheres, disabled frustumCulled, adaptive draw range (drops particles below 20 FPS, recovers above 30), feedFps() render loop integration. Fixed starfield disposal leak.