1. Is this true?
2. If it is true, should I manually inline functions like the following?
public static int Min(int x, int y) {
if (x < y) return x;
else return y;
}
public static int Min(int x, int y) {
if (x < y) return x;
else return y;
}
댓글 3개:
Yes, it is true.
You should only inline manually after you've measured and thereby determined that manual inlining is necessary to meet your performance constraints.
The conclusive answer to the second question should of course be: *no* you shouldn't do manual inlining.
Instead, let the profiler guide your manual optimizations. If performance is of the essence, switch to a platform with better JIT, pre-compilation (PGO?) or whatever your project needs instead.
Perhaps spend your time improving the JIT instead of doing brainless 'optimization'?
댓글 쓰기