From e4b8d8a84a8359d7e77c603d349c149b82d57018 Mon Sep 17 00:00:00 2001 From: Viktor Lidholt Date: Mon, 10 Aug 2015 10:05:35 -0700 Subject: [PATCH] Improves particle performance by never having doubles as null (5% gain in performance test) --- examples/game/lib/particle_system.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/game/lib/particle_system.dart b/examples/game/lib/particle_system.dart index ad1dcbe832..a5167d9135 100644 --- a/examples/game/lib/particle_system.dart +++ b/examples/game/lib/particle_system.dart @@ -4,16 +4,16 @@ class _Particle { Vector2 pos; Vector2 startPos; - double colorPos; - double deltaColorPos; + double colorPos = 0.0; + double deltaColorPos = 0.0; - double size; - double deltaSize; + double size = 0.0; + double deltaSize = 0.0; - double rotation; - double deltaRotation; + double rotation = 0.0; + double deltaRotation = 0.0; - double timeToLive; + double timeToLive = 0.0; Vector2 dir; @@ -25,8 +25,8 @@ class _Particle { } class _ParticleAccelerations { - double radialAccel; - double tangentialAccel; + double radialAccel = 0.0; + double tangentialAccel = 0.0; } class ParticleSystem extends Node {