What is the fastest way to load 10,000 rows from a SQLite database into memory? Each row has 1 text and 4 integers. Currently, I'm doing this:
while(!cursor.isAfterLast()) {
cursor.copyStringToBuffer(column_index_1, buffer);
cursor.copyStringToBuffer(column_index_2, buffer);
cursor.copyStringToBuffer(column_index_3, buffer);
cursor.copyStringToBuffer(column_index_4, buffer);
cursor.copyStringToBuffer(column_index_5, buffer);
cursor.moveToNext();
}
The above code takes about 750 ms on Galaxy Nexus. On older devices it could be couple of times slower. Can I make it faster?
(At this point, you're probably typing something like "Why do you need to load the rows into memory?" It's a bit complicated but I can try to explain if someone's interested. Edit: here's the explanation: https://gist.github.com/fhucho/af355d56ae3145e3e30f)