float[] → Vertex[] – decreases performance by 1000%
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Jul 24 12:12:09 PDT 2012
On Tue, Jul 24, 2012 at 08:57:08PM +0200, bearophile wrote:
> David:
>
> >align(1) struct Vertex {
> > float x;
> > float y;
> > float z;
> > float nx;
> > float ny;
> > float nz;
> > float u_terrain;
> > float v_terrain;
> > float u_biome;
> > float v_biome;
> >}
> >
> >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).
[...]
I agree. I don't know how the CPU handles misaligned floats, but from
what I understand, it will do two loads to fetch the two word-aligned
parts of the float, and then assemble it together. This may be what's
causing the slowdown.
T
--
Маленькие детки - маленькие бедки.
More information about the Digitalmars-d-learn
mailing list