Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Vector of Pointers

Vector of Pointers

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsdata-structureshelpquestion
23 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Stephen Hewitt

    As I mentioned, you've got iterator range checking enabled. See here[^] for details. Your comparison isn't fair because the raw array isn't doing any range checks. If you define _SECURE_SCL as 0 the range checking will be disabled and the code will be identical.

    Steve

    R Offline
    R Offline
    Rajkumar R
    wrote on last edited by
    #21

    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

    S 1 Reply Last reply
    0
    • R Rajkumar R

      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

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #22

      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
      #endif

      I 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 simple inline functions.

      Steve

      1 Reply Last reply
      0
      • S Stephen Hewitt

        There is nothing wrong with using std::vectors. Contrary to what some people have been saying, in most cases using a vector is just as fast as using raw memory allocation functions.

        Steve

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #23

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups