Should I use float3 or float array?

Should I use float3 or float array?

Hello,Three-components vector type is often used in engineering like velocity. Although built-in float3 is very convenient, it uses float4 for memory alignment which means memory waste. And the plain float array doesn't have this problem but the codes become a little more complex. What's the best practice for 3 components vector?Thanks!ZHAO Peng

2 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

The answer depends on the device you are running. Typically vector data types are mapped to the underlying SIMDhardware. So using vector data types is much faster than using scalars. But some devices may only have scalar hardware so there is no performance benefit in using vector types. If the wasted memory is not that critical (its only small anyway), its better to use vector types.


Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui