I have a Particle System Engine in my C++ project and the particles themselves are just structs of variables with no functions. Currently, each particle (Particle) is updated from its parent class (ParticleSystem) by having its variables accessed directly. E.g.
particle.x += particle.vx;
I am however, debating using getters and setters like this:
particle.setX( particle.getX()+particle.getVX() );
My question is: Is there any performance overhead from calling getters and setters as opposed to just straight up data access?
After all, I do have many many particles to update through...
question from:https://stackoverflow.com/questions/13853424/getters-and-setters-is-there-performance-overhead