Re: Pre-expanding alloc cell(s) / reserving space for an associative array

2023-07-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/10/23 8:44 AM, H. S. Teoh wrote: On Mon, Jul 10, 2023 at 09:30:57AM +, IchorDev via Digitalmars-d-learn wrote: [...] From the spec it sounds as though (but good luck testing for sure) that if you have (for example) 6 big dummy key-value pairs in the AA to begin with, then if you use `

Re: Pre-expanding alloc cell(s) / reserving space for an associative array

2023-07-10 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jul 10, 2023 at 09:30:57AM +, IchorDev via Digitalmars-d-learn wrote: [...] > From the spec it sounds as though (but good luck testing for sure) > that if you have (for example) 6 big dummy key-value pairs in the AA > to begin with, then if you use `.clear` it "Removes all remaining ke

Re: Pre-expanding alloc cell(s) / reserving space for an associative array

2023-07-10 Thread IchorDev via Digitalmars-d-learn
On Sunday, 9 July 2023 at 20:24:24 UTC, Cecil Ward wrote: Before I posted a question about avoiding unnecessary allocs/reallocs when adding entries to an array like so uint[ dstring ] arr; when I build it up from nothing with successive insertions. The array is accessed by a key that is a

Re: Pre-expanding alloc cell(s) / reserving space for an associative array

2023-07-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/9/23 4:24 PM, Cecil Ward wrote: Before I posted a question about avoiding unnecessary allocs/reallocs when adding entries to an array like so     uint[ dstring ]  arr; when I build it up from nothing with successive insertions. The array is accessed by a key that is a dstring. I was told

Pre-expanding alloc cell(s) / reserving space for an associative array

2023-07-09 Thread Cecil Ward via Digitalmars-d-learn
Before I posted a question about avoiding unnecessary allocs/reallocs when adding entries to an array like so uint[ dstring ] arr; when I build it up from nothing with successive insertions. The array is accessed by a key that is a dstring. I was told that I can’t use .reserve or the like