This same question was just asked recently on the General Programming board, and has probably been discussed several times already. I think that you will find that the general consensus is that classes can hinder performance in some cases, and can improve it in others. Just as poorly written procedural code will run poorly, poorly written OOP code will run poorly. There are some algorithms that are better suited for a class architechture, and some that are better suited for a more procedural implementation. So my suggestion is that unless you need to or want to do it the way that you are not most comfortable doing it, just stick with what you are used to, however, knowing how to work with both can be a good thing.
j.w.
Perfomance with classes
to Krunk - and everyone other :
please - Sigma is my right nick - just chosen ZGL_Sigma because Sigma is given away already. (ZGL = ZeusGL my last project - never ended because I started too much and never ended)
please - Sigma is my right nick - just chosen ZGL_Sigma because Sigma is given away already. (ZGL = ZeusGL my last project - never ended because I started too much and never ended)
I hate signatures !!!
personaly I wouldn''t touch pure C type program with 10m pole. About speed comparison: many things depend on your compiler. Writing a OOP in 4 years old compiler is suicide but in new one (like MSVC.NET) there is no difference in speed.
There are more worlds than the one that you hold in your hand...
There are more worlds than the one that you hold in your hand...
You should never let your fears become the boundaries of your dreams.
Although it''s been corrected already, I''ll reiterate - classes do not equal slower performance, bad coding equals slow performance. I would also like to suggest Scott Meyer''s Effective C++ and More Effective C++. He goes over many great topics (85 tips between the two books). It''s late or else I''d go into more detail relating it to this thread, but a great read for anyone wanting to make clean, efficient, and correct classes.
Jason
Jason
When i wanted to switch my engine from C to C++, i did a test, with a pretty complex calculation done on an array of vertices.
The C++ version was faster than the C one !
You might see some performance hurt if you start using virtual functions though. If you just make sure you don''t use them for "common" classes (vertices, triangles, etc.. ) then you shouldn''t see any difference between C in C++, except it''s *a lot* easier to develop in C++.
Just my opinion.
Y.
The C++ version was faster than the C one !
You might see some performance hurt if you start using virtual functions though. If you just make sure you don''t use them for "common" classes (vertices, triangles, etc.. ) then you shouldn''t see any difference between C in C++, except it''s *a lot* easier to develop in C++.
Just my opinion.
Y.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement