performance updates to jar and zip

Xueming Shen xueming.shen at oracle.com
Thu Nov 3 00:18:16 UTC 2011



On 10/31/2011 5:11 PM, Mike Skells wrote:
>
> (2) Iti is true that this is not a performance gain by code 
> improvement, but it is a performnce gain by specification.
> The same arguement applies to allowing a Zip Compression of 1 rather 
> than the default. As for the spec, all I have seen is that it should 
> provide the date is available.
> I am not that fussed if we include this in another section and I that 
> all specification changes need to be considered seperately, as long as 
> it is not lost
>
> I ran you test and I did not see more than 15% difference in the 
> scanning with jav2DosTime includes/excluded. Minimal time in profiler 
> reported as well
> Running the same time on the same files via the sample improved app 
> that you supplied I see 16% of the time spent in javaToDosTime
>
> Could this be a micro-benchmark issue? (aqnd/or a profiling issue)
> In the benchmarks that I have for the full jar app I see usually 5-10% 
> total time reduction in the tests that are CPU bound
>

I don't think java2DosTime can take 5-10% of the total time of jarring 
25k files with a total of 50M+ bytes.
A straight N iteration of it should give us some idea whether not it it 
can take that much of time.

I finally got your patch "worked" on JDK8 for Z2/Z3 case, by commenting 
out line#112 of FileScanning.java
http://cr.openjdk.java.net/~sherman/mtjar/webrev/src/share/classes/sun/tools/jar/FileScanning.java.html

It appears startPath.relativize() returns something (../) you might not 
expect to work on.

Observation:

(1) cf6Z2 works, but slower than Z3

@flicker-vm2:/tmp/sherman/test]../mtjar2-linux/bin/java Jar cf6Z2 rt.jar rtjar
Jar TotalTime:3402
Jar TotalTime:3363
Jar TotalTime:3460
Jar TotalTime:3468
Jar TotalTime:3594

(2) Z3 is faster but it creates a 0-length rt.jar, a bug somewhere

[@flicker-vm2:/tmp/sherman/test]../mtjar2-linux/bin/java Jar cf6Z3 rt.jar rtjar
Jar TotalTime:2921
Jar TotalTime:2974
Jar TotalTime:2998
Jar TotalTime:2856
Jar TotalTime:2883

(3) -D such as cf6DZ2 cf6DZ3 does not appear to have any significant/meaningful image to the
overall time spent.

(4) it takes about 7xxx ms for the same jar by using a un-touched jdk8 jar
[@flicker-vm2:/tmp/sherman/test]../orig-linux/bin/java Jar cf rt.jar rtjar
Jar TotalTime:7472
Jar TotalTime:7298
Jar TotalTime:7979
Jar TotalTime:7599

(5) Z4, 5 still throws exception as showed below. I'm yet to dig into the code to see what went wrong.

[@flicker-vm2:/tmp/sherman/test]../mtjar2-linux/bin/java Jar cf6Z4 rt.jar rtjar
Warmup:rtjar...done
java.lang.NullPointerException
	at java.util.zip.ZipChannelWriter.rewriteReserved(ZipChannelWriter.java:211)
	at java.util.zip.AbstractRewritingZipWriter.writeMissingHeaderInfo(AbstractRewritingZipWriter.java:44)
	at java.util.zip.AbstractZipWriter.startWritingDeflator(AbstractZipWriter.java:611)
	at java.util.zip.AbstractZipWriter.writeWithResource(AbstractZipWriter.java:347)
	at java.util.zip.AbstractZipWriter.writeAll(AbstractZipWriter.java:273)
	at sun.tools.jar.Main$ZipOutputLoader2File.call(Main.java:410)
	at sun.tools.jar.Main$ZipOutputLoader2File.call(Main.java:350)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
	at java.util.concurrent.FutureTask.get(FutureTask.java:111)
	at sun.tools.jar.Main.waitFor(Main.java:810)
	at sun.tools.jar.Main.run(Main.java:679)
	at Jar.main(Jar.java:39)
Caused by: java.lang.NullPointerException
	at java.util.zip.ZipChannelWriter.rewriteReserved(ZipChannelWriter.java:211)
	at java.util.zip.AbstractRewritingZipWriter.writeMissingHeaderInfo(AbstractRewritingZipWriter.java:44)
	at java.util.zip.AbstractZipWriter.startWritingDeflator(AbstractZipWriter.java:611)
	at java.util.zip.AbstractZipWriter.writeWithResource(AbstractZipWriter.java:347)
	at java.util.zip.AbstractZipWriter.writeAll(AbstractZipWriter.java:273)
	at sun.tools.jar.Main$ZipOutputLoader2File.call(Main.java:410)
	at sun.tools.jar.Main$ZipOutputLoader2File.call(Main.java:350)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
java.io.IOException: java.lang.InterruptedException
	at java.util.zip.AbstractZipWriter.writeAll(AbstractZipWriter.java:289)
	at sun.tools.jar.Main$ZipOutputLoader2File.call(Main.java:410)
	at sun.tools.jar.Main$ZipOutputLoader2File.call(Main.java:350)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.InterruptedException
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2038)
	at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:374)
	at java.util.zip.DefaultZipResourcePool.acquire(DefaultZipResourcePool.java:50)
	at java.util.zip.DefaultZipResourcePool.exchange(DefaultZipResourcePool.java:114)
	at java.util.zip.AbstractZipWriter.writeAll(AbstractZipWriter.java:272)







More information about the core-libs-dev mailing list