Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: DataOutputStream performance under OS X



> -----Original Message-----
> From: Don Werder [SMTP:email@hidden]
> Sent: Wednesday, July 30, 2003 1:38 PM
> To: Robert Ross
> Cc: email@hidden
> Subject: RE: DataOutputStream performance under OS X
>
>
> Are you saying that the other non-OS X operating systems are
> automatically buffering when reading and writing? What is the cause
> in the improvement in the output times reported by Hagman on the
> Linux machines when comparing DataOutputStream and
> BufferedOutputStream? Is this additional buffering?
> Is DataOutputStream actually writing to disk and BufferOutputStream
> is writing to the buffer? Is that what each time is measuring?

OK, I modified the original code something like so...

for(int i=1; i<=6; i++) {
long lastlen = 0;
StringBuffer statmsg;
FileOutputStream fd = new FileOutputStream("test"+i);
File outfile = new File("test"+i);
DataOutputStream targ = new DataOutputStream(fd);

for(int j=1; j<=200*200; j++) {
targ.writeByte(0);
if (outfile.length() != lastlen) {
statmsg = new StringBuffer("iteration ").append(i).append(" write ").append(j).append(" length now ").append(outfile.length());
System.out.println(statmsg.toString());
lastlen = outfile.length();
}

So it checks after every write if the file length shows as having changed and tells you the write count number and the new size. Running that on this setup...

***** Current Environment *****
Java Version: 1.4.0_01
Java Class API: 48.0
Java Compiler: null
Operating System: Windows NT
Machine Architecture: x86
Operating System version: 4.0
*****

This shows the number of size changes assuming meaning times I/O was physically written? The question. I'll omit the full messaging for something like brevity...

BOS DOS
7 - 15 1 - 4
8 - 14 2 - 11
9 - 14 3 - 16
10 - 15 4 - 1
11 - 15 5 - 10
12 - 10 6 - 8

DataOutputStream actually appears to physically write less often? Sort of strange.

Mike Hall <email@hidden>
<http://www.spacestar.net/users/mikehall>
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.