melonjs/melonJS — pull request #372 by insidiator (2014-01-10 16:37:13+00:00)
Title: improved particle system performance

I tried the new particle system today and noticed, that it runs a bit slow, especially when using the additive mode.
After some profiling and tinkering around I managed to improve the performance a bit.
There is still much room for improvements, but I think it's a solid start.

The examples show the following fps improvements:
```
before | after
blending | normal | lighter | normal | additive
Fire | 46 | 26 | 60 | 40
Smoke | 48 | 27 | 60 | 56
Fountain | 16 | 7 | 60 | 38
Fireball | 23 | 12 | 60 | 57
Rain | 34 | 18 | 60 | 30
Cannon | 60 | 60 | 60 | 60
Explosion Radial | 35 | 16 | 60 | 25
Explosion Directed | 60 | 60 | 60 | 60
Waterfall | 15 | 10 | 60 | 24
Multiples | 21 | 14 | 60 | 33
```

The rain and waterfall example look a bit different than before, but I have not looked into the cause yet.

I think the matrix class could be helpful in managing the transformation of the individual particles.
Also I am planning to try a different approach to the additive mode, because it costs too much performance to use the globalCompositionOperation.