3 ms·
The benchmarks lack the standard deviation, so the results may well be equivalent. Don't roll your own micro-benchmark runners. References may get optimized to
by zamalek 4y ago
The benchmarks lack the standard deviation, so the results may well be equivalent. Don't roll your own micro-benchmark runners.
References may get optimized to copies where possible and sound (i.e. blittable and const), a common heuristic involves the size of a cache line (64b on most modern ISAs, including x86_64).
Using a Vector4 would have pushed the structure size beyond the 64b heuristic. You would also need to disable inlining for the measured methods.
- cogman10 4y agoIt was also (needlessly) using 2 different compilers, MSVC and LLVM. This is just a bad way to compare things all around. And, for simple operations like this, you really should just look at the assembly output. If you are only generating 20ish instructions, then look at those 20 instructions rather than trying to heuristically guess what is happening.