Click here to Skip to main content
15,887,320 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
doug255-Jan-10 2:40
doug255-Jan-10 2:40 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
Moak5-Jan-10 3:41
Moak5-Jan-10 3:41 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
doug255-Jan-10 15:10
doug255-Jan-10 15:10 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
doug255-Jan-10 16:44
doug255-Jan-10 16:44 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
Moak5-Jan-10 23:16
Moak5-Jan-10 23:16 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
doug256-Jan-10 3:43
doug256-Jan-10 3:43 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
Moak6-Jan-10 12:51
Moak6-Jan-10 12:51 
GeneralRe: Restricting rights to delete a dynamic array ? [modified] Pin
doug256-Jan-10 16:14
doug256-Jan-10 16:14 
There's virtually no performance difference between a vector and dynamic array most of the time, I agree.

I'm certain my measurements are correct but I decided to take a few more to get a better idea of the exact difference.

The test program was compiled in release mode with full optimizations, Maximize Speed, Favor fast code, no debug info...

The results show that reading values stored in a dynamic array can be anywhere from 1 times faster and above compared to reading values from a vector in the normal way i.e. using the overloaded subscript operator.

When fewer accesses are made, there will be virtually no difference in the time taken by a vector and dynamic array i.e. dynamic array is 1... times faster than vector, but if a million accesses are done at once, array is about 8000 times faster. Not quite sure why, but that's how it works.

Certain 3d computations for example might benefit from the extra performance that using dynamic arrays directly can provide. When I started using C++, I came accross a program that could help manipulate pixels on the screen faster than using e.g. windows GDI, I converted the vectors used to dynamic arrays and got a massive difference in performance on a fast computer (that was two years ago, so it's still a "fast computer"). But that was unusual, so probably vectors are almost always the best way to go.

modified on Wednesday, January 6, 2010 11:48 PM

GeneralRe: Restricting rights to delete a dynamic array ? Pin
Moak7-Jan-10 1:03
Moak7-Jan-10 1:03 
GeneralRe: Restricting rights to delete a dynamic array ? Pin
doug257-Jan-10 11:38
doug257-Jan-10 11:38 
Questioncommunication between objects Pin
Alex80gbg1-Jan-10 8:44
Alex80gbg1-Jan-10 8:44 
AnswerRe: communication between objects Pin
Rozis2-Jan-10 8:17
Rozis2-Jan-10 8:17 
GeneralRe: communication between objects Pin
Alex80gbg2-Jan-10 11:52
Alex80gbg2-Jan-10 11:52 
QuestionLNK2019 for XmlLite Pin
A&Ms1-Jan-10 8:30
A&Ms1-Jan-10 8:30 
AnswerRe: LNK2019 for XmlLite Pin
A&Ms1-Jan-10 11:14
A&Ms1-Jan-10 11:14 
GeneralRe: LNK2019 for XmlLite Pin
conrad Braam3-Jan-10 4:04
conrad Braam3-Jan-10 4:04 
QuestionPort 7078 and 7077 blocked in Vista Pin
Larry Mills Sr1-Jan-10 6:00
Larry Mills Sr1-Jan-10 6:00 
QuestionNeed help with member function pointer Pin
anbluemoon31-Dec-09 19:18
anbluemoon31-Dec-09 19:18 
AnswerRe: Need help with member function pointer Pin
KingsGambit31-Dec-09 19:44
KingsGambit31-Dec-09 19:44 
GeneralRe: Need help with member function pointer Pin
anbluemoon31-Dec-09 21:14
anbluemoon31-Dec-09 21:14 
AnswerRe: Need help with member function pointer Pin
N a v a n e e t h1-Jan-10 3:53
N a v a n e e t h1-Jan-10 3:53 
QuestionHow to use CreateProcess win 32 api function Pin
NIR WINTER31-Dec-09 12:29
NIR WINTER31-Dec-09 12:29 
AnswerRe: How to use CreateProcess win 32 api function Pin
Garth J Lancaster31-Dec-09 13:07
professionalGarth J Lancaster31-Dec-09 13:07 
AnswerRe: How to use CreateProcess win 32 api function Pin
Chuck O'Toole31-Dec-09 15:15
Chuck O'Toole31-Dec-09 15:15 
AnswerRe: How to use CreateProcess win 32 api function Pin
Rozis1-Jan-10 4:58
Rozis1-Jan-10 4:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.