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

Simon s.d.hammett at gmail.com
Tue Jul 24 12:21:09 PDT 2012


On 24/07/2012 20:08, David wrote:
> Am 24.07.2012 20:57, schrieb bearophile:
>> David:
>>> Everything is still a float, so it's easier. Nothing wrong with that
>>> or? Well this change decreases my performance by 1000%.
>>
>> Aligning floats to 1 byte doesn't seem a good idea. Try to remove the
>> aling(1).
>>
>> Bye,
>> bearophile
>
> This makes no difference.

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.

-- 
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk




More information about the Digitalmars-d-learn mailing list