The performance overhead is mostly prepaid; it's the result of the overhead of having the type() member. It might be efficient to retrieve the item->type() once. You know it doesn't change, but chances are the compiler doesn't.
The performance overhead is mostly prepaid; it's the result of the overhead of having the .type() member. It might be efficient to retrieve the item->type() once. You know it doesn't change, but chances are the compiler doesn't.
Edit Also, if you really have a lot of types, it could be worthwhile to introduce some intermediate types. Eg. If (dynamic_cast(item)) {/* check those types */} else {/* other types */}.
That is a good point. – kleimola Jun 10 '10 at 8:41 Yup. Now you're fetching it for every comparison.
I think it's a virtual call, and while cheap those are not free. Multiply that by every object in every scene, and you have a lot of cheap calls - no longer so cheap, then. – MSalters Jun 10 '10 at 12:21.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.