Re: Why is JAR so slow?
- From: Wibble0@xxxxxxxxx
- Date: 31 Mar 2006 11:45:32 -0800
Roedy Green wrote:
On 31 Mar 2006 11:17:41 -0800, Wibble0@xxxxxxxxx wrote, quoted or
indirectly quoted someone who said :
I meant zip, not gzip. Sorry.
You mean winzip, PkZip, 7Zip, WinRar?
Zip utilitiies don't build manifests. I gather you are doing that
manually?
Zip utilities are highly tuned native assembler code. So it is no
surprise that the generic code in jar.exe is much slower.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
I'm using solaris & cygwin zip.
I'm creating manifests manually.
I'm exec'ing the zip from ant, as opposed to using ant's jar task.
<macrodef name="fastJar"><!-- jar is slow, so zip -->
<attribute name="jarFile"/>
<attribute name="basedir"/>
<attribute name="javaVersion" default="1.4.2"/>
<attribute name="zipdirs" default="com"/>
<sequential>
<dirname file="@{jarFile}" property="dir_@{jarFile}"/>
<echo message="dbg:fastJar @{jarFile} @{baseDir} @{zipdirs}"/>
<mkdir dir="@{basedir}/META-INF"/>
<property name="metaInf.@{jarFile}" value=" META-INF"/>
<echo file="@{basedir}/META-INF/MANIFEST.MF"
message="Manifest-Version: 1.0${line.separator}Created-By:
@{javaVersion} (Sun Microsystems Inc.)${line.separator}"/>
<echo message="exec: zip -q -r @{jarFile}${metaInf.@{jarFile}}
@{zipdirs}"/>
<dirname property="dir.@{jarFile}" file="@{jarFile}"/>
<mkdir dir="${dir.@{jarFile}}"/>
<tempfile property="tmpJar.@{jarFile}"
destDir="${dir.@{jarFile}}" prefix="tmpJar" suffix=".zip"/>
<exec executable="zip" failonerror="true" dir="@{basedir}">
<arg line="-q -r ${tmpJar.@{jarFile}}${metaInf.@{jarFile}}
@{zipdirs}"/>
</exec>
<move file="${tmpJar.@{jarFile}}" tofile="@{jarFile}"/>
</sequential>
</macrodef>
.
- References:
- Why is JAR so slow?
- From: Wibble
- Re: Why is JAR so slow?
- From: Roedy Green
- Re: Why is JAR so slow?
- From: Wibble0
- Re: Why is JAR so slow?
- From: Roedy Green
- Why is JAR so slow?
- Prev by Date: Azul Java Server
- Next by Date: about external jar file dependency in ant build
- Previous by thread: Re: Why is JAR so slow?
- Next by thread: Reflecting generics
- Index(es):
Relevant Pages
|