Windows multi-threading performance issues on multi-core systems only

Michel Fortin michel.fortin at michelf.com
Tue Dec 15 08:01:51 PST 2009


On 2009-12-15 10:28:37 -0500, dsimcha <dsimcha at yahoo.com> said:

> void doAppending() {
>     uint[] arr;
>     foreach(i; 0..1_000_000) {
>         arr ~= i;
>     }
> }

For comparison's sake, you might want to compare that with malloc/realloc:

void doAppending() {
	uint* arr = null;
	foreach(i; 0..1_000_000) {
		arr = realloc(arr, (uint*).sizeof * (i+1));
		arr[i] = i;
	}
	// leak arr
}

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list