what i did exactly is separating the object from main class. So here is the deal:
im coverting from C++ to C++. but im not that comfortable with the structure of the class. i have class Mash contains Triangles and vertices. but both triangles and vertices are just an entity of a vector of primitive object(int, float, boolean). i want those triangles treated as object so instead of calling vector trianglePosition[i], i prefer to call triangle.position(). and also instead of having each vertices listed in the mesh, i want those vertices become objects in triangles. here is my question: is calling vertices[i].move() will take less time than calling triangle[i].vertices[k].move() ? well i know it will but is it that significant? this move() method will be called most of the time. thanks in advance --- On Mon, 12/8/08, Thomas Hruska <[EMAIL PROTECTED]> wrote: > From: Thomas Hruska <[EMAIL PROTECTED]> > Subject: Re: [c-prog] How OOP affect performance > To: [email protected] > Date: Monday, December 8, 2008, 8:40 PM > Jos Timanta Tarigan wrote: > > hi, > > > > im currently trying to convert a code from functional > to OOP. but the program is performance sensitive kind of > program. is it that significant to change from functional to > OOP? how it will affect the programs performance(time and > memory)? is it that much different from calling a function > compared to a function from another object? > > > > thanks in advance > > > > > > regards > > A 1:1 conversion (i.e. you already use OOP-style > programming principles > in C) should result in negligent performance loss. If > anything, you may > end up with faster code than your equivalent C code (e.g. > sorting can be > done inline, which is typically 25-50% faster than the best > C qsort() > implementation). > > -- > Thomas Hruska > CubicleSoft President > Ph: 517-803-4197 > > *NEW* MyTaskFocus 1.1 > Get on task. Stay on task. > > http://www.CubicleSoft.com/MyTaskFocus/
