Hello, what is a good way to measure the performance of a particular function in visual studios (2013)? I read some articles about using a stopwatch and looping the function a million times, but I want to know if VS or some plugin does this for you.
The code I'm testing is part of a first-person camera class:
#1: Using references
public void Forward()
{
Vector3 tempdir;
Vector3.Multiply(ref direction, Speed, out tempdir);
Vector3.Multiply(ref tempdir, dt, out tempdir);
Vector3.Add(ref position, ref tempdir, out position);
}
vs #2: Copying (need better terminologies)
public void Forward()
{
position += direction * Speed * dt;
}
I would assume that #1 is faster than #2 by a very negligible amount at 60FPS, hence I may want to write it like #2 for readability. What is your take on optimization in game engines on modern hardware? Would it be alright to write code like #2 except for performance critical areas.