Performance: Particle lifetime and speed
MEDIUM IMPACT
This affects how fast particles are created, updated, and removed, impacting frame rate and smoothness of animations.
var particle = new Particle(); particle.lifetime = 2f; // reasonable lifetime particle.speed = 20f; // moderate speed // limit max particles and reuse with pooling
var particle = new Particle(); particle.lifetime = 10f; // very long lifetime particle.speed = 100f; // very high speed // many particles created without limit
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Long lifetime + high speed | Many active particles updated each frame | N/A | High GPU overdraw and fill rate | [X] Bad |
| Short lifetime + moderate speed | Fewer active particles, efficient updates | N/A | Lower GPU overdraw | [OK] Good |