I noticed in two applications to generate hashes of files, one written in Java and the other in C#, that the performance is horrible when reading from a DVD. I'm using Windows XP SP3. I noticed from the noise, that the drive keeps spinning down after reading a bunch of blocks, causing pauses of a couple of seconds between reads.
The strange thing, is that this doesn't happen when I use explorer to copy the files to my hard drive or when using md5sum (a utility written in C). Also. When running in Linux using the same hardware, the Java application works fine.
private static final byte[] m_buf = new byte[1048576*3];
...
//Using a BufferedInputStream makes no difference
InputStream in = new FileInputStream(file);
while((last_read = in.read(m_buf)) != -1){
update_hash(m_buf, 0, last_read);
}
in.close();
Any hints?
Thanks.