Why is my particle effect engine slower in parallel than sequential?

0
3
Asked By SunsetSky42 On

I'm working on a particle effect engine for my college project that needs to handle both sequential and parallel processing. However, I've noticed that the sequential version performs significantly better than the parallel one. I suspect this might be due to the overhead from using ConcurrentHashMap for collision detection and possibly in the collision handling as well. I'm a bit confused about where to look for optimization opportunities. Has anyone else encountered this issue and found a solution?

3 Answers

Answered By DebugDynamo On

I tested with anywhere from 1000 to 100k particles, and the parallel execution still takes longer. I think the issue might be from resetting values and incrementing a shared atomic counter when particles die out. It seems like a lot of particles dying simultaneously might be causing contention on that shared variable.

Answered By TechGuru99 On

What data size are you working with? For smaller datasets, parallel processing often can’t keep up with sequential due to the overhead of managing threads.

Answered By ParticlePonderer On

Have you tried running your engine through a profiler? It could help pinpoint the slow parts of your code more accurately.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.