Is It (Still) Better To Re-Use Objects For Mass Particle Effects And Such?

If I’m creating lots of non-physical decorative objects, like sparks or dust from images, which will be used for all kinds of ongoing effects in large numbers – is it better to reuse these from the same batch of eternally-existing objects, and keep those objects hidden while unused… or can I now safely create & then destroy new objects on the fly?

My concern is CPU/ speed/ FPS. I’m thinking about doing such “reusable” objects speed optimization and having a batch of say 200 sprites “on hold and ready for action” but invisible, to be reused when needed. But I’m wondering if Corona has such optimization built in by now?

Thanks!

Hm.

I tried that (“particle pooling”) as an experiment for CBEffects (my particle engine library) and it didn’t seem to have much of an effect. If anything, it slowed it down. I’m guessing it’s because I had, let’s say, 35 particles all moving around, alpha-ing, shrinking, growing, etc., on the screen for an effect. So that’s all well and fine. Compare that with 35 particles all moving around, alpha-ing, shrinking, growing, etc., _but also 50 particles sitting invisibly off-screen. _So in the end, the first method went faster - you can keep minimal particles on-screen or the same number of particles on-screen but also a big pool invisible on-screen.

Just my two cents :slight_smile:

C

Thanks, this is helpful!

Curious to hear even more opinions or even a Corona team member jumping in.

Hm.

I tried that (“particle pooling”) as an experiment for CBEffects (my particle engine library) and it didn’t seem to have much of an effect. If anything, it slowed it down. I’m guessing it’s because I had, let’s say, 35 particles all moving around, alpha-ing, shrinking, growing, etc., on the screen for an effect. So that’s all well and fine. Compare that with 35 particles all moving around, alpha-ing, shrinking, growing, etc., _but also 50 particles sitting invisibly off-screen. _So in the end, the first method went faster - you can keep minimal particles on-screen or the same number of particles on-screen but also a big pool invisible on-screen.

Just my two cents :slight_smile:

C

Thanks, this is helpful!

Curious to hear even more opinions or even a Corona team member jumping in.