Re: tasklist/checkstyle version dep
Jesse Glick <[email protected]> Mon, 16 Feb 2004 18:38:04 -0500
| Newsgroups | gmane.comp.java.netbeans.modules.tasklist.devel |
|---|---|
| Organization | Sun Microsystems |
| Message-ID | <[email protected]> |
Petr Kuzel wrote: >> Is Jesse's suggestion of File.createTempFile() that much of a >> headache? > > In development time few lines of code. In runtime probably several > hundreds milliseconds. [...] Microseconds, not milliseconds, I hope you mean. Try the attached test. -J. -- Jesse Glick <mailto:[email protected]> x22801 NetBeans, Open APIs <http://www.netbeans.org/> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
MakeTempFiles.java
(text/x-java, 754 B)
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class MakeTempFiles {
private static final int COUNT = 1000;
public static void main(String[] args) throws IOException {
long start = System.currentTimeMillis();
for (int i = 0; i < COUNT; i++) {
File f = File.createTempFile("foo", ".txt");
OutputStream os = new FileOutputStream(f);
try {
os.write(new byte[9999]);
} finally {
os.close();
}
f.delete();
}
long end = System.currentTimeMillis();
System.out.println("" + COUNT + " iterations took " + (end - start) + " msec");
}
}