RFR: 8293017: Improve hash calculation parallelism in jmod/jlink [v2]

Aleksey Shipilev shade at openjdk.org
Mon Aug 29 12:15:18 UTC 2022


On Mon, 29 Aug 2022 09:33:44 GMT, Сергей Цыпанов <duke at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Touchups
>
> src/java.base/share/classes/jdk/internal/module/ModuleHashes.java line 170:
> 
>> 168:     static ModuleHashes generate(Set<ModuleReference> mrefs, String algorithm) {
>> 169:         Map<String, byte[]> nameToHash = new ConcurrentHashMap<>();
>> 170:         mrefs.stream().parallel().forEach(mref -> {
> 
> [AFAIK](https://stackoverflow.com/questions/28985704/parallel-stream-from-a-hashset-doesnt-run-in-parallel) streams taken from HashSet might have weak parallelism, so maybe it's worth wrapping `mrefs` into an ArrayList?

I instrumented the parallel tasks, and confirmed the full parallelism is used. So this is not an issue.

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

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


More information about the core-libs-dev mailing list