RFR: 8292681: Add JMH for ProtectionDomain

David Schlosnagle duke at openjdk.org
Wed Aug 24 05:47:49 UTC 2022


On Fri, 19 Aug 2022 18:48:10 GMT, Eric Caspole <ecaspole at openjdk.org> wrote:

> Add a JMH for ProtectionDomain related to current work on JDK-8292375. Also, add the InMemoryJavaCompiler to the JMH jar, to generate the classes needed for this test and will be useful for future class loading JMH too.

test/micro/org/openjdk/bench/java/security/ProtectionDomainBench.java line 49:

> 47: @OutputTimeUnit(TimeUnit.MILLISECONDS)
> 48: @Warmup(iterations = 15)
> 49: @Measurement(iterations = 15)

Given the recent work to reduce microbenchmark runtimes, does this actually need this many iterations and time to get a stable microbenchmark?

test/micro/org/openjdk/bench/java/security/ProtectionDomainBench.java line 73:

> 71:                 + "       intField++;"
> 72:                 + "   }"
> 73:                 + "}");

Curious why copying to new String? Is this to try to avoid string deduplication? Could it be simplified?

Suggestion:

        return "public class B" + count + " {"
                + "   static int intField;"
                + "   public static void compiledMethod() { "
                + "       intField++;"
                + "   }"
                + "}";

-------------

PR: https://git.openjdk.org/jdk/pull/9950



More information about the security-dev mailing list