Re: Reserve on dynamic arrays

2016-07-14 Thread cym13 via Digitalmars-d-learn
On Thursday, 14 July 2016 at 09:29:10 UTC, Jonathan M Davis wrote: On Thursday, July 14, 2016 07:20:46 cym13 via Digitalmars-d-learn wrote: [...] Whatever the profiler is telling you, it's clearly not actually telling you whether an allocation took place, and that's easy to test. For instanc

Re: Reserve on dynamic arrays

2016-07-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 14, 2016 07:20:46 cym13 via Digitalmars-d-learn wrote: > As one can see there seem to be absolutely no difference in > allocations wether we reserve or not. I've ran more experiences, > reserving way less or more than I appened to no avail: > allocations seem to just ignore it. >

Reserve on dynamic arrays

2016-07-14 Thread cym13 via Digitalmars-d-learn
Does changing the capacity of dynamic arrays actually do anything with respect to memory allocation? I have the following data with DMD 2.071.1 // With dmd -profile=gc void main() { import std.stdio; int[] arr = [1, 1, 1]; arr.reserve(512); foreach (i ; 0..10) arr ~=