Vector of Pointers
-
Hi, if we disabled range checking it affects all STL containers we use . Yes, the comparison is not fair so i said raw array and vector are different. This is only a simply operator we have other operators/ interface that have more expensive operations. A single additional instruction will be neglegible for application which uses it less frequently. IN 3D graphics application, point(vertex) is the building block. Millions of triangle for single 3D object will have 3*Millions of vertex. a single additional instruction will have 3*Million instruction this will reduce the performance. I repeat I put simple example operator [], but for other interfaces we can't even set _SECURE_SCL like definition to 0. Yes STL is best. But I just want to ensure the above statement. Mr. kevinbrydon may use this application for thousand of triangle today, he may use it for millions of triangle tomorrow. Best Regards Raj
-
Hi, if we disabled range checking it affects all STL containers we use . Yes, the comparison is not fair so i said raw array and vector are different. This is only a simply operator we have other operators/ interface that have more expensive operations. A single additional instruction will be neglegible for application which uses it less frequently. IN 3D graphics application, point(vertex) is the building block. Millions of triangle for single 3D object will have 3*Millions of vertex. a single additional instruction will have 3*Million instruction this will reduce the performance. I repeat I put simple example operator [], but for other interfaces we can't even set _SECURE_SCL like definition to 0. Yes STL is best. But I just want to ensure the above statement. Mr. kevinbrydon may use this application for thousand of triangle today, he may use it for millions of triangle tomorrow. Best Regards Raj
Rajkumar_R wrote:
if we disabled range checking it affects all STL containers we use .
That's exactly what I want to happen in a release build. In my opinion, and that of many others, checked iterators should not be enabled in release builds by default anyway. I use code like this in my precompiled header to get it to work this way:
#ifdef NDEBUG
#define _SECURE_SCL 0
#endifI encourage you to do this and have another look at the release build's machine code. For most operations a
vector
's performance will be the same as that of a raw array (as it was in the MSVC6 code I posted). All the member functions are simpleinline
functions.Steve
-
There is nothing wrong with using
std::vector
s. Contrary to what some people have been saying, in most cases using avector
is just as fast as using raw memory allocation functions.Steve
Stephen Hewitt wrote:
Contrary to what some people have been saying, in most cases using a vector is just as fast as using raw memory allocation functions.
Hey Stephen, I just stumbled upon this old thread. In general or specifically for business apps STL is more than adequate. However I do have some minor experience in Console Gaming development and for the graphics rendering I do believe the point being made about DirectX for example might be valid. Rendering, several years back when I was involved, was a huge bottleneck and some advances have been made in that area and I seem to remember reading about what Rajkumar_R is talking about in DirectX. For production graphics I would think one would certainly want to use the current approach being supported by any particular graphics platform.
led mike