float[] → Vertex[] – decreases performance by 1000%

David d at dav1d.de
Tue Jul 24 12:44:26 PDT 2012


> Could be that your structs are getting default initialised so you will
> be getting a constructor called for every instance of a Vertex.
>
> This will be a lot slower than a float array.
> Try void initialising your Vertex arrays.
>
> http://dlang.org/declaration.html
>
> See the bit Void Initializations near the bottom.
>
> Also make sure that you are passing fixed size arrays by reference.
>

No. The vertices are just created once (with a call to the default ctor) 
and immedialty added to the Vertex* but they are never instantiated.


More information about the Digitalmars-d-learn mailing list