I am optimizing my code for my n-body simulator, and when profiling my code I saw this:

These two lines,
float diffX = (pNode->CenterOfMassx - pBody->posX);
float diffY = (pNode->CenterOfMassy - pBody->posY);
Where pNodeis a pointer to an object of the type Nodethat I defined and contains (with other things) 2 floats, CenterOfMassxandCenterOfMassy
Where pBodyis a pointer to an object of the type Bodythat I defined and contains (with other things) 2 floats, posXand posY.
It should take the same amount of time, but not do it. In fact, the first row takes into account 0.46% of the sample of functions, and the second - 5.20%.
Now I see that the second line contains 3 commands, and the first - only one.
My question is: why do they seem to do the same thing, but in practice different things?