Usually, yes. However, when you're writing very performance-sensitive code, using scalars instead of structs can help the optimizer perform better
For example, if you have:
// atom forces
typedef struct float3 {
float x;
float y;
float z;
} float3;
the code here on Intel's site suggests changing:
// position is an array of float3
float3* position;
for (int k=0; k<dis; k++){
jpos = position[ neighList[j*dis + k + maxNeighbors * i] ];
float delx = ipos.x - jpos.x;
float dely = ipos.y - jpos.y;
float delz = ipos.z - jpos.z;
float r2inv = delx*delx + dely*dely + delz*delz;
to
for (int k=0;k<dis;k++){
jposx = position[ neighList[j*dis + k + maxNeighbors * i] ].x;
jposy = position[ neighList[j*dis + k + maxNeighbors * i] ].y;
jposz = position[ neighList[j*dis + k + maxNeighbors * i] ].z;
float delx = iposx - jposx;
float dely = iposy - jposy;
float delz = iposz - jposz;
float r2inv = delx*delx + dely*dely + delz*delz;
... because it helps the compiler efficiently vectorize the memory accesses:
To help the compiler generate better vector code, sometimes it helps to decompose complex data structures to allow the compiler to understand the available parallelism and vectorize the code.
So yes, scalars can be faster because the optimizer can optimize them better. However, note that you should only worry about this if this is a bottleneck in your code, and you should actually test it to see if it's the case in your situation; this is not meant to be a "rule of thumb" of any sort.