RFR: 8298920: Improve microbenchmark build times [v2]

Magnus Ihse Bursie ihse at openjdk.org
Wed Aug 21 09:16:11 UTC 2024


On Wed, 21 Aug 2024 06:15:43 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> Currently incremental builds for the microbenchmarks may take notable amount of time, like:
>> 
>> $ touch test/micro/org/openjdk/bench/java/io/BlackholedOutputStream.java; time make test TEST=jaxp:tier1
>> Building target 'test' in configuration 'linux-x86_64-server-release'
>> Compiling up to 656 files for BUILD_JDK_MICROBENCHMARK
>> Running Indify on microbenchmark classes
>> [snip]
>> ==============================
>> Test summary
>> ==============================
>>    TEST                                              TOTAL  PASS  FAIL ERROR
>>    jtreg:test/jaxp:tier1                                 0     0     0     0
>> ==============================
>> TEST SUCCESS
>> 
>> Finished building target 'test' in configuration 'linux-x86_64-server-release'
>> 
>> real    0m37,581s
>> user    2m4,747s
>> sys     0m7,223s
>> 
>> 
>> The microbenchmark compilation is not using the `Depend` plugin that avoids recompilation of other files if the change files only contain minor changes (i.e. non-API changes). The patch here proposes to enhance the build to use the `Depend` plugin. The change that enables that is `CREATE_API_DIGEST := true,`, but since both the `Depend` plugin and JMH framework needs to be added to the classpath the patch re-organizes the code a little to properly augment the classpath.
>> 
>> With this patch, a build similar to the above might be:
>> 
>> $ touch test/micro/org/openjdk/bench/java/io/BlackholedOutputStream.java; time make test TEST=jaxp:tier1
>> Building target 'test' in configuration 'linux-x86_64-server-release'
>> Compiling up to 656 files for BUILD_JDK_MICROBENCHMARK
>> Running Indify on microbenchmark classes
>> [snip]
>> ==============================
>> Test summary
>> ==============================
>>    TEST                                              TOTAL  PASS  FAIL ERROR
>>    jtreg:test/jaxp:tier1                                 0     0     0     0
>> ==============================
>> TEST SUCCESS
>> 
>> Finished building target 'test' in configuration 'linux-x86_64-server-release'
>> 
>> real    0m7,505s
>> user    0m14,128s
>> sys     0m3,158s
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixing classpath for incremental microbenchmark build.

make/common/JavaCompilation.gmk line 297:

> 295: 
> 296:     $1_EXTRA_DEPS := $$(BUILDTOOLS_OUTPUTDIR)/depend/_the.COMPILE_DEPEND_batch
> 297:     $1_AUGMENTED_CLASSPATH += $$(BUILDTOOLS_OUTPUTDIR)/depend

I think it would be better if you added `$$($1_BIN)` to the classpath whenever CREATE_API_DIGEST is true, rather than hard-coding it in the case of the microbenchmarks. 

Maybe you can also add a couple of lines of comments explaining the rationale, if you can make it succinct enough.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20616#discussion_r1724720149


More information about the build-dev mailing list