Unfortunately that doesn't explain the speed problem.  The processor
is almost 600MHz, that means it's taking 2400 CPU cycles *per byte* on
the read operation.  An unbelievable overhead.  Also I get 5MB/s both
up and down when connecting over USB, so the O/S (which is admittedly
running native code, not Dalvik bytecodes) can go much, much faster
than that, and it's not that the speed of flash memory is the
bottleneck either.  The overhead of Dalvik is not *that* high, so
something else is going on that is making this about an order of
magnitude slower than it should be.  Does anyone else have any ideas?


On Nov 22, 9:55 am, "Sunit Katkar" <[EMAIL PROTECTED]> wrote:
> Phones in general do not have super fast CPUs like laptop and desktops.
> Android runs on a phone CPU which is not very fast. Overall you will see
> that programs dont necessarily run at the same speed as on a laptop.
> - Sunit Katkarhttp://sunitkatkar.blogspot.com/- Android OS Tutorials
>
> On Fri, Nov 21, 2008 at 8:08 PM, ______ <[EMAIL PROTECTED]> wrote:
>
> > I measure the speed of copying files to/from the SD card at about 5MB/
> > sec on my G1, however the following speed test tops out at about 250kB/
> > sec read and 125kB/sec write.  (The example shown writes to the
> > internal SD card, but writing to the removable card is about the same
> > speed.) Why is it so slow?  (Using NIO channels to write whole arrays
> > of bytes doesn't speed it up by much...)
>
> > --
>
> > long startTime = System.currentTimeMillis();
> > BufferedOutputStream writer = new BufferedOutputStream(openFileOutput
> > ("speedtest", MODE_PRIVATE));
> > int size = 1000000;
> > for (int i = 0; i < size; i++)
> >        writer.write((byte) 0);
> > writer.close();
> > Log.i("speedtest", "speed test a: " + (System.currentTimeMillis() -
> > startTime));
> > startTime = System.currentTimeMillis();
>
> > BufferedInputStream in = new BufferedInputStream(openFileInput
> > ("speedtest"));
> > for (int i = 0; i < size; i++)
> >        in.read();
> > in.close();
>
> > Log.i("speedtest", "speed test b: " + (System.currentTimeMillis() -
> > startTime));
> > startTime = System.currentTimeMillis();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to