<br><br><div class="gmail_quote">On Fri, Jun 26, 2009 at 01:37, Ulf Zibis <span dir="ltr"><<a href="mailto:Ulf.Zibis@gmx.de">Ulf.Zibis@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Am 26.06.2009 02:57, Martin Buchholz schrieb:<div class="im"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I did some benchmarking,<br>
and found that my changes "only" make jar 10-20% faster.<br>
Disappointing - we expect an order of magnitude for every commit!<br>
</blockquote>
<br></div>
1. Hopefully some volunteer would be found to fix <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6818737" target="_blank">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6818737</a><br>
before JDK7 API-freeze.<br>
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.<div class="im"></div></blockquote><div>
<br>The way to motivate us around here <br>is to provide the prototype implementation that<br>demonstrates the speedup.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
While benchmarking, I discovered to my horror that the simple<br>
<br>
jar cf /tmp/t1 ...<br>
jar i /tmp/t1<br>
<br>
fails, because it tries to create the replacement jar in "." and then<br>
rename() it into place.  Oops... Better refactor out the code that<br>
puts the replacement temp file in the same directory.<br>
Better write some tests for that, too.<br>
</blockquote>
<br></div>
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.<br>
It blows up the code, and following the code demands annoying scrolling.<br>
Better add additional comment to original code.<br>
</blockquote><div><br>The original code created temp files in *two* places, <br>and did it differently.<br><pre><span class="new">I think the name<br>createTempFileInSameDirectoryAs<br>makes the current code much clearer.<br>
</span></pre>Also, JITs tend to be very good at inlining.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
3. What happens, if original file is exactly named "jartmp"<br>
I think you would better add ".tmp" at the end of the filename, and remove it later.<br>
Does your new code work with? :<br>
jar cf /jartmp/t1 ...<br>
jar i /jartmp/t1<br><font color="#888888">
</font></blockquote><div><br>File.createTempFile doesn't literally create a file named jartmp.<br>That's only the prefix.  And it promises to return <br>a freshly created empty file.<br> <br>Martin<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<font color="#888888"><br>
-Ulf<br>
<br>
<br>
<br>
</font></blockquote></div><br>