any impact on performance from javac's debug option ?
Ulf Zibis
Ulf.Zibis at gmx.de
Sun Aug 10 15:29:57 PDT 2008
Much thanks for this interesting discussion.
This reminds me to post an other question regarding inlining. More about
it next days.
-Ulf
Am 04.08.2008 23:36, Martin Buchholz schrieb:
> FYI: I filed the bug a few years ago
>
> http://bugs.sun.com/view_bug.do?bug_id=6445664
> 6445664: Eliminate remaining performance penalty for using assert
>
> where I wrote:
>
> Core library maintainers should be encouraged to use assert,
> so that more bugs could be found running tests with -esa.
> However, library maintainers are reluctant to do this because of
> lingering Fear Uncertainty and Doubt that their performance-critical
> code will run a little slower.
>
> One concern is the inlining threshold, which is based on the size of
> methods based on bytecode, which does not take into account code which
> is dead because it is conditional on a static final boolean.
>
> So library code maintainers fiddle with various inlining and "out"-lining
> strategies for static final booleans and asserts.
>
> private static final boolean flag = ....;
>
> void m() { if (flag} { ... } else { ... } }
> or
> void m1() { ... } void m2() { ... } void m() { if (flag) m1(); else m2(); }
>
> A compiler-maintainer-oriented way of expressing this request is:
> before any method's size as measured in bytecodes is used
> for inlining heuristics, make sure a dead-code elimination pass
> that takes final static booleans (or ints?) into account should
> be used to derive a better size for using with inlining heuristics.
>
> Another issue is the startup cost for computing asserts.
> Each class containing an assert runs a bit of code to initialize the
> synthetic static final boolean via a jni call. If every class in the JDK
> did this, this cost might be significant. Even if the cost is small, the
> cost is borne by every Java program that uses those classes, which, in the
> case of some core classes, means every Java program period.
>
> Martin
>
> On Mon, Aug 4, 2008 at 1:09 PM, Tom Rodriguez <Thomas.Rodriguez at sun.com> wrote:
>
>> Unfortunately yes. There's a bug filed about it though I don't remember the
>> id offhand.
>>
>
>
>
More information about the hotspot-dev
mailing list