6
Answers

Multiple assignment vs object creation

time and space

time and space

13y
1.7k
1
Which would be faster?

oldPosition = new Vector2(position.X, position.Y); 

OR

oldPosition.X = position.X; 
oldPosition.Y = position.Y; 

I'm assuming the second example is more efficient since a new object isn't being created, unless the compiler automatically optimises such things?
Answers (6)