Hi cowwoc, > I guess you're right. It is probably as likely that the JIT will optimize > away the null check as it is that it will optimize away the > NullPointerException check. One exception, though, is when production > systems run using -Xverify:none. In such a case, wouldn't my approach run > faster? I don't think it will optimize the null-check away, however it is so cheap that it most likely will not weight at all, compared to all the other operations happening there. Its maybe 5 instructions compared to thousands or even more. -Xverify:none only disables bytecode verification at class-loading time and has no influence (as far as I know) on the performance of the generated code.
> I still think that my proposed code is somehow more consistent/cleaner on a > design-level but I guess that's just me :) I also like it more, its cleaner in my opinion :) > As an aside, are there standard benchmarks for testing the impact of this > change? I'd love to know whether it actually produces any performance > difference in practice. >From my experience i would rather guess that you won't notice the change, noise will be higher. lg Clemens
