Once again: what you are running in the emulator is a complete ARM-
based system (linux kernel, standard libraries including SQLite, and
dalvik interpreter) being interpreted by the emulator.
8 seconds vs. .63 second = 12:1 performance difference is quite good
for a complete ARM emulator. :)
That said, running on a modern CPU, the emulator is going to give you
something vaguely roughly similar to the performance on real device.
Or in other words, the performance you see in the emulator is probably
much closer to the real performance on a device than what you would
get running that native x86 SQLite code. So you could well have a
performance issue here, and need to tune your database (adding indexes
and such) to improve performance.
On Apr 15, 3:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I was shocked how slow SQLite works on Android.
>
> For a selection of 374 rows, four columns (two integers and two
> strings ~10 chars each), it took about 8 seconds.
> Outside android same selection was finished in 63ms.
>
> Of that time about 4 seconds each was taken by
> SQLiteStatement.native_1x1_long and
> SQLiteStatement.simpleQueryForLong.
>
> Why is it so slow? Is it because of java interface, or sqlite itself
> works that slow on Android? Will that be fixed soon?
>
> Code was following
>
> cursor = db.rawQuery("select attr_id, attr_name, attr_value, acc_id
> from attributes", null);
> while(cursor.next()){
> ...
>
> }
>
> Db structure can be seen here
>
> http://code.google.com/p/android-tabletop/wiki/DbPresentation
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---