Miscellaneous improvements to "jar".

Ulf Zibis Ulf.Zibis at gmx.de
Fri Jun 26 08:37:39 UTC 2009


Am 26.06.2009 02:57, Martin Buchholz schrieb:
> I did some benchmarking,
> and found that my changes "only" make jar 10-20% faster.
> Disappointing - we expect an order of magnitude for every commit!

1. Hopefully some volunteer would be found to fix 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6818737
before JDK7 API-freeze.
Especially, if jar is not compressed, as in case of normal JDK 
installation, reading entries from jar should be much faster through 
java.nio.channels, than via BuffererdInputStream.

>
> While benchmarking, I discovered to my horror that the simple
>
> jar cf /tmp/t1 ...
> jar i /tmp/t1
>
> fails, because it tries to create the replacement jar in "." and then
> rename() it into place.  Oops... Better refactor out the code that
> puts the replacement temp file in the same directory.
> Better write some tests for that, too.

2. I don't like to refactor out the code in case of only once used, and 
only to better "comment" what the 2 lines are doing.
It blows up the code, and following the code demands annoying scrolling.
Better add additional comment to original code.

3. What happens, if original file is exactly named "jartmp"
I think you would better add ".tmp" at the end of the filename, and 
remove it later.
Does your new code work with? :
jar cf /jartmp/t1 ...
jar i /jartmp/t1

-Ulf






More information about the core-libs-dev mailing list