On Tue, 15 Oct 2024 16:08:32 GMT, Claes Redestad <redes...@openjdk.org> wrote:
> I guess performance leans on there being only one or a small number of > versions per entry. I checked Spring Petclinic: * 109 JAR dependencies * 15 are multi-release enabled. * The 15 MR-JARs have 9347 entries, of which 21 are versioned * 9 of 15 MR JARs use the feature exclusively to hide `module-info.class` from Java 8. * 3 of the 6 remaining JAR files version a single class file * The remaining JARs mostly version on the 9 release. * The maximum number of versioned entries in a file is 5. * Zero entries have more than a single version. > Which I think is a fair assumption. Still would be good to have a stress test > with many entries having many versions and make sure we don't regress such > cases too much, no? Such a test would be somewhat speculative. If I add 5 versions of each entry in `ZipFileOpen`, then yes, this PR sees a regression over mainline: Baseline: Benchmark (size) Mode Cnt Score Error Units ZipFileOpen.openCloseZipFile 1024 avgt 15 718234.380 ? 29454.645 ns/op PR: Benchmark (size) Mode Cnt Score Error Units ZipFileOpen.openCloseZipFile 1024 avgt 15 1284944.601 ? 74919.522 ns/op While `JarFileGetEntry` improves over baseline: Baseline: Benchmark (mr) (size) Mode Cnt Score Error Units JarFileGetEntry.getEntryHit false 1024 avgt 15 68.984 ? 2.791 ns/op JarFileGetEntry.getEntryHit true 1024 avgt 15 324.763 ? 9.690 ns/op JarFileGetEntry.getEntryHitUncached false 1024 avgt 15 95.884 ? 1.404 ns/op JarFileGetEntry.getEntryHitUncached true 1024 avgt 15 333.491 ? 3.576 ns/op JarFileGetEntry.getEntryMiss false 1024 avgt 15 37.358 ? 2.215 ns/op JarFileGetEntry.getEntryMiss true 1024 avgt 15 650.467 ? 5.116 ns/op JarFileGetEntry.getEntryMissUncached false 1024 avgt 15 61.059 ? 0.382 ns/op JarFileGetEntry.getEntryMissUncached true 1024 avgt 15 678.457 ? 4.390 ns/op PR: Benchmark (mr) (size) Mode Cnt Score Error Units JarFileGetEntry.getEntryHit false 1024 avgt 15 61.333 ? 3.665 ns/op JarFileGetEntry.getEntryHit true 1024 avgt 15 153.987 ? 8.889 ns/op JarFileGetEntry.getEntryHitUncached false 1024 avgt 15 90.008 ? 4.158 ns/op JarFileGetEntry.getEntryHitUncached true 1024 avgt 15 168.831 ? 1.676 ns/op JarFileGetEntry.getEntryMiss false 1024 avgt 15 34.525 ? 1.878 ns/op JarFileGetEntry.getEntryMiss true 1024 avgt 15 61.036 ? 2.568 ns/op JarFileGetEntry.getEntryMissUncached false 1024 avgt 15 75.246 ? 20.375 ns/op JarFileGetEntry.getEntryMissUncached true 1024 avgt 15 81.484 ? 1.981 ns/op Future work could probably improve this situation by shifting version resolution to `initCEN` time. That way, only the single version relevant to the `JarFile` `featureVersion` would need to be considered. That's not so easy to do currently, since this happens in `JarFile`s super constructor. But with flexible constructor bodies, we may be able to do something. But not for this PR. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21489#discussion_r1804355452