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

David d at dav1d.de
Wed Jul 25 04:21:15 PDT 2012


Am 25.07.2012 01:10, schrieb Era Scarecrow:
>> Remvoing the `align(1)` changes nothing, not 1ms slower or faster,
>> unfortunately.
>
>
> [quote]
> [code]
>   Vertex[] data;
>   foreach(i; 0..6) {
>     data ~= Vertex(positions[i][0], positions[i][1], positions[i][2],
> [/code]
> [/quote]
>
> Try using reserve? The new structure size looks like it's about 40
> bytes, and aside from resizing I'm not sure why it would have issues.
>
> [code]
>   Vertex[] data;
>   data.reserve(6); //following foreach...
> [/code]

Also not the problem, I returned the whole array at once and it didn't 
help. But thanks for your idea.


The strange thing is, this tessellation function(s) are just run once 
and then the data is passed to the GPU.
So my comment shouldn't have a direct impact on the speed (e.g. GC issue 
would explain it, but unfortunatly it isn't the GC).

I'll try a different compiler, too.


More information about the Digitalmars-d-learn mailing list