Passing ziptime-info=false to ZipFileSystemProvider (along with other classpath performance ideas)

Jaikiran Pai jai.forums2013 at gmail.com
Sat Mar 22 10:06:22 UTC 2025


Hello Jason,

For the proposal to set zipinfo-time=false when constructing the zipfs 
FileSystem in the compiler code, I've created 
https://bugs.openjdk.org/browse/JDK-8352642. Since you have already 
experimented with the changes, could you create a PR with just that 
change for review?

-Jaikiran

On 17/03/25 10:15 am, Jason Zaugg wrote:
> On Sun, 16 Mar 2025 at 19:40, Jaikiran Pai <jai.forums2013 at gmail.com> 
> wrote:
>
>     Hello Jason,
>
>     On 02/03/25 7:13 pm, Jason Zaugg wrote:
>     > I've been analysing the performance of javac in a relatively large
>     > codebase and found classpath scanning to be the dominant factor.
>     There
>     > are large numbers of compilation tasks, most with long classpaths
>     > including large JARs.
>     >
>     > I've been using the wall-time profiling mode of async-profiler to
>     > analyse where time is being spent.
>     >
>     > I've been able improve build times (most dramatically on
>     Windows, 750s
>     > reduced to 350s) by modifying javac to:
>     >
>     > 1. pass ziptime-info=false to the env Map of
>     > jarFsProvider.newFileSystem, which means the classpath scan in the
>     > constructor of ArchiveContainer need only read the ZIP central
>     > directory, rather then reading per-entry Extended Time metadata.
>
>     I am not familiar with the compiler implementation code, but
>     speaking in
>     context of the ZipFileSystem, it appears that this (undocumented)
>     "ziptime-info" property of the ZIP file system was indeed
>     introduced to
>     help improve the performance of the ZipFileSystem. Setting it to
>     false
>     implies that the lastAccessTime() and the creationTime() returned
>     by the
>     ZipFileAttributes may not be accurate for some entries, since
>     settings
>     this property to false skips reading the per entry creation and
>     access
>     time information for the entries. Would you happen to know if
>     either of
>     these two methods are used in the code path where you are
>     proposing to
>     add "ziptime-info=false"?
>
>     -Jaikiran
>
>
> I am not aware of any use of these attributes within javac, nor does 
> it seem likely that they would be used.
>
> But the difference in the attributes could be observed by a client of 
> JavaFileManager that
> unwraps the underlying Path from a JavaFileObject representing a JAR 
> entry.
>
> ```
> jshell> var compiler = javax.tools.ToolProvider.getSystemJavaCompiler();
> compiler ==> com.sun.tools.javac.api.JavacTool at 4b9e255
>
> jshell> var fileManager = compiler.getStandardFileManager(null, null, 
> null)
> fileManager ==> com.sun.tools.javac.file.JavacFileManager at 7f416310
>
> jshell> var head = 
> fileManager.list(javax.tools.StandardLocation.CLASS_PATH, "", 
> Set.of(javax.tools.JavaFileObject.Kind.OTHER), true).iterator().next()
> head ==> JarFileObject[/Users/jz/Library/Caches/Coursier/v ... 
> e/protobuf/wrappers.proto]
>
> jshell> java.nio.file.Files.readAttributes(fileManager.asPath(head), 
> java.nio.file.attribute.BasicFileAttributes.class)
> $11 ==>     name            : /google/protobuf/wrappers.proto
>     creationTime    : Fri Feb 14 21:06:54 AEST 2020
>     lastAccessTime  : Fri Feb 14 21:06:54 AEST 2020
>     lastModifiedTime: Fri Feb 14 21:06:54 AEST 2020
> ...
> ```
>
> A new option could be added to toggle between the existing and 
> proposed behaviour if this is a concern.
>
> Regards,
>
> Jason Zaugg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20250322/a9ade7d5/attachment.htm>


More information about the compiler-dev mailing list