Optimize fillWindow to improve reverse-seek performance.

Bug: 5520301

When an application requests a row from a SQLiteCursor that
is not in the window, instead of filling from the requested
row position onwards, fill from a little bit ahead of the
requested row position.

This fixes a problem with applications that seek backwards
in large cursor windows.  Previously the application could
end up refilling the window every time it moved back
one position.

We try to fill about 1/3 before the requested position and
2/3 after which substantially improves scrolling responsiveness
when the list is bound to a data set that does not fit
entirely within one cursor window.

Change-Id: I168ff1d3aed1a41ac96267be34a026c108590e52
This commit is contained in:
Jeff Brown 2011-10-27 14:52:28 -07:00
parent 991ddd13a6
commit 20b3da9a01
1 changed files with 1 additions and 1 deletions

View File

@ -209,7 +209,7 @@ uint32_t CursorWindow::alloc(size_t size, bool aligned) {
uint32_t offset = mHeader->freeOffset + padding;
uint32_t nextFreeOffset = offset + size;
if (nextFreeOffset > mSize) {
LOGE("Window is full: requested allocation %d bytes, "
LOGW("Window is full: requested allocation %d bytes, "
"free space %d bytes, window size %d bytes",
size, freeSpace(), mSize);
return 0;