I’ve read in multiple different places that square root operations are slow and should generally be avoided within the update loop. However, I’ve noticed that the Distance and normalization functions on Vector2 and Vector3 perform fairly well and don’t seem to cause any problems when I use them in my Update function.
Do these functions actually perform square root operations? If not, what kind of approximations are they using to achieve the same result?
Yes, these function are doing square root operations, which is why there are alternatives like squared magnitude and DistanceSquared to get around those slower methods.
However the speed difference will likely be generally unnoticeable unless you are making a lot of calls to them each frame (and I mean a lot) typically there is no problem using the more costly methods and you wont necessarily have to optimize them unless you really start seeing performance issues and need to get every bit of performance you can back.
These kind of suggestions are for developers whose aim is to “maximize” the performance. That differences won’t even be visible to human eyes.