Quote Originally Posted by Graham View Post
The only way you're going to get a definitive answer is to put together a test harness and time the two approaches. Never try to second-guess such fine differences.
Quote Originally Posted by PredicateNormative View Post
The best thing to do is test it, since the answer to your question is compiler and system dependent. However, that said, on tests that I had done in the past with VS2005 on a P4, char's where certainly faster to construct than assign, and I think the same was also true for int's. I'm not sure about short's (on some systems, despite being two bytes, these are slower than int's). Doubles were faster to assign than construct.

Again, I stress, that testing is the best option since the answer to your question is compiler and system dependent. But, my general rule (which may be misplaced) is, built in types of 4 bytes or less where the value is different on each pass, I'll construct and initialise inside the loop, but anything else (including user defined types), I'll construct and initialise outside of the loop, and assign within the loop.

If you are really bothered about which is faster and want an absolute answer though, then profile it, and pick the most appropriate solution.

I assume that you are passing point to some_func by reference?
Ok. Seems I've found my answer. Are there any profilers that you'd recommend that work with Visual Studio? I'd be better off using a proper one than writing my own test code as at least I can use it again.

In the actual scenario, yes, I do pass point by reference to some_func.