[Issue 2504] Reserve for associative arrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 30 21:24:05 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2504
--- Comment #3 from ZY Zhou <rinick at gmail.com> 2009-11-30 21:24:04 PST ---
(In reply to comment #2)
> No, this is because, on the second run, the program has already reserved a
> bunch of memory from the OS, so the GC doesn't run as often.
try this:
import std.stdio;
void main(){
int[int] a;
foreach(i;0..20_000_000){
a[i] = i;
if((i&0xFFFF) == 0) writeln(i);
}
}
You can see how slow it becomes when AA is large.
I don't think memory allocation could take so much time.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list