Bear: > Using D1, I have a program that creates tons of float[] ; for performance > reasons, I would like them to be uninitialized. > I've tried replacing > > float[] f = new float[x]; > by > float[] f = cast(float[])std.gc.malloc(x*4);
Try something like this (untested): alias float TF; TF[] f = (cast(TF*)std.gc.malloc(x * TF.sizeof))[0 .. x]; Using x*4 is error-prone. I suggest to wrap that code inside a templated function, where T is the type of the items, to avoid some bugs. Bye, bearophile