DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9704>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9704
Checksum task needs buffer
Summary: Checksum task needs buffer
Product: Ant
Version: 1.5Beta2
Platform: All
OS/Version: All
Status: NEW
Severity: Enhancement
Priority: Other
Component: Core tasks
AssignedTo: ant-dev@jakarta.apache.org
ReportedBy: gjfdh@yahoo.com
Thank for adding a <checksum> task. I hope you will change it so it buffers
its input file.
The plain <checksum> task worked for 40+ minutes on a 210MB file. With the
addition of a 1MB buffer, the speed went to 27 seconds. This is a major
improvement and makes the checksum task competitive with other existing MD5
utilities.
Checksum.java currently iterates over dis.read() in its generateChecksums()
method. The read method reads one byte at a time. To add a buffer, you could
modify the code:
From:
> while (dis.read() != -1) {
> ;
> }
To:
> byte[] buffer = new byte[bufferSize];
> while (dis.read(buffer, 0, buffer.length) != -1) {
> ;
> }
and add a setter method for the integer bufferSize.
> /**
> * Size of read buffer.
> * Defaults to 10K.
> */
> public void setBufferSize(int bufferSize) {
> this.bufferSize = bufferSize;
> }
Then we can specify the buffer size through build.xml:
<target name="checksum">
<checksum buffersize="1024000">
<fileset dir="${fileset.dir}">
<exclude name="**/*.MD5"/>
</fileset>
</checksum>
</target>
and have a speedy md5 checksum calculator. Please rename "bufferSize" as you
see fit. If there's a way to say "1MB" instead of "1024000" that would be nice
to have as well.
--
To unsubscribe, e-mail: <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
|