Yep that's ridiculously slow. What are you writing to the file? Are you
streaming it from the internet? Have you tried posting the code one
stackoverflow? Have you tried mounting the sdcard on your computer and
moving a file there to check what the time should be?
Try using a
Agree with all the above. Er, below. What Miguel said. :-)
A lot of I/O problems stem from inefficient writing algorithms (e.g.,
byte-at-a-time).
Another test you can try is using DDMS File Manager or adb push to
write a file to the SD card. If that is similarly slow, then the
problem may be
Well I am not doing anything fancy - I am using the following code
segment to write
the image to the card - are you doing something similar?
String path =
Environment.getExternalStorageDirectory().toString()
+ /p2pSOA;
OutputStream outS = null;
You are writing one byte at a time.
outS.write(data[i]);
This is going to be incredibly slow
Try this:
outS.write(data, 0, data.length)
or just this:
outS.write(data);
-- Kostya
23.05.2011 20:01, kypriakos пишет:
Log.i(p2pSOA,write start at +sTime);
Thanks Kostya, Miquel and Mark,
yes I agree, inefficient I/O algorithms would kills ya particularly
on constrained devices. I posted the one byte at at time segment
but I did try buffering data before writing it and using what Kostya
pointed out below (outS.write(data, 0, data.length). I am also
I think since both methods of either buffering in memory and then
writing
all bytes at once OR writing a byte at a time are both slow it makes
me
believe is the hardware. I tried the tests that you guys suggested and
the pushing files to it is slow as hell. I am assuming that means the
good
ol'
First, good to hear from you Mark - I hope all is well!
Well I expected the two (instead of three) letter response - I ended
up playing around
with the code (which is nothing other than using the FileOutputStream
to write out
the jpeg. I found out that if I replace the println statements (I was
In my app, copying a 4MB file to the SD card takes maybe 5 seconds. I
am using the Commons IO library.
So you are doing something wrong if it takes more than a couple of
seconds for a 1MB file.
On May 23, 11:27 am, kypriakos demet...@ece.neu.edu wrote:
First, good to hear from you Mark - I
8 matches
Mail list logo