Click here to Skip to main content
15,913,722 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionreserve method of vector Pin
George_George15-Nov-07 4:49
George_George15-Nov-07 4:49 
AnswerRe: reserve method of vector Pin
Nemanja Trifunovic15-Nov-07 4:56
Nemanja Trifunovic15-Nov-07 4:56 
GeneralRe: reserve method of vector Pin
George_George15-Nov-07 15:54
George_George15-Nov-07 15:54 
AnswerRe: reserve method of vector Pin
led mike15-Nov-07 4:58
led mike15-Nov-07 4:58 
GeneralRe: reserve method of vector Pin
George_George15-Nov-07 16:07
George_George15-Nov-07 16:07 
GeneralRe: reserve method of vector Pin
led mike16-Nov-07 5:04
led mike16-Nov-07 5:04 
GeneralRe: reserve method of vector Pin
George_George18-Nov-07 1:25
George_George18-Nov-07 1:25 
GeneralRe: reserve method of vector Pin
Matthew Faithfull15-Nov-07 5:07
Matthew Faithfull15-Nov-07 5:07 
In terms of Virtual Memory it will be committed. This doesn't mean it won't end up being paged out to a swap file/page file though.

Any perfromance improvement will depend on how you're using the vetor and on what else the machine is doing. In general if you're working with a larger number of items but only 1 at a time, adding and deleting more or less at random then reserving will give you the greatest performance gain. If you're performing entirely linear operations, add 10,000 items, then iterate over them a few times in order, then free them, it will give you very little or nothing.
Testing memory performance is tricky because new and delete do 50x and more as much work in Debug as in Release. Other factors like low memory or task switching or heavy use of non-paged pool in comms apps can easily swamp and distort your figures beyond use. Reserving of course also has the down side of using more memory than you actually need. It all depends whether you're optimising for memory footprint or speed. Of course you could write your own heap manager and override the global new and delete operators. If it's good enough for the .NET team it must be OK right?Big Grin | :-D



Nothing is exactly what it seems but everything with seems can be unpicked.

GeneralRe: reserve method of vector Pin
George_George15-Nov-07 16:29
George_George15-Nov-07 16:29 
QuestionHttp Request Pin
San246815-Nov-07 4:28
San246815-Nov-07 4:28 
AnswerRe: Http Request Pin
led mike15-Nov-07 4:54
led mike15-Nov-07 4:54 
GeneralRe: Http Request Pin
San246815-Nov-07 5:10
San246815-Nov-07 5:10 
GeneralRe: Http Request Pin
led mike15-Nov-07 5:25
led mike15-Nov-07 5:25 
Questionchanging the cursor postion in a editable combobox??? Pin
SnaKeBeD15-Nov-07 3:39
SnaKeBeD15-Nov-07 3:39 
AnswerRe: changing the cursor postion in a editable combobox??? Pin
DoomedOne15-Nov-07 5:34
DoomedOne15-Nov-07 5:34 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
Deepu Antony15-Nov-07 7:45
Deepu Antony15-Nov-07 7:45 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
SnaKeBeD15-Nov-07 7:49
SnaKeBeD15-Nov-07 7:49 
QuestionRe: changing the cursor postion in a editable combobox??? Pin
David Crow15-Nov-07 8:42
David Crow15-Nov-07 8:42 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
DoomedOne15-Nov-07 9:45
DoomedOne15-Nov-07 9:45 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
chandu00415-Nov-07 21:05
chandu00415-Nov-07 21:05 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
Nelek15-Nov-07 23:46
protectorNelek15-Nov-07 23:46 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
chandu00416-Nov-07 20:55
chandu00416-Nov-07 20:55 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
Nelek19-Nov-07 21:39
protectorNelek19-Nov-07 21:39 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
SnaKeBeD16-Nov-07 4:33
SnaKeBeD16-Nov-07 4:33 
GeneralRe: changing the cursor postion in a editable combobox??? Pin
DoomedOne16-Nov-07 6:53
DoomedOne16-Nov-07 6:53 

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.