Tuesday, December 15, 2009

Re: [android-developers] Why first call to Cursor.getCount() is so slow?

Hi,

The query doesn't actually do much. The Cursor is lazily loaded so
it's only the first method call to access data (like getCount()) that
loads the content of the rows.

> On the other hand if I query some ContentProvider (using getContext
> ().getContentResolver().query()) then this query takes about 100
> milliseconds to finish, which is understood. But then first call (and
> subsequent calls) to any of Cursor methods described above is very
> fast.

The performance of getContentResolver().query() depends on what the
provider uses as a backend. A Cursor is not necessarily backed by a
database. Also, it will depend on how much data you are querying and
returning.

--
Romain Guy
Android framework engineer
romainguy@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support. All such questions should be posted on
public forums, where I and others can see and answer them

--
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
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate