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