简体   繁体   中英

Which option is faster using Intents in Android - SQLite index or Parcelable object?

I was wondering as I am now writing app using SQLite database also sending some informations between activities. What is faster and better:

  • Using SQLite and send to Activity only record (object) index and in this Activity open, and read data
  • Using Parelable with Intent and send like this object. In Activity read data from Parcelable object.

I am only talking about option when object is only read . Now write, edited or in any other way modified.

What is you opinion?

You'd need to benchmark to verify, but I suspect that using a Parcelable is faster. It can be done entirely in memory and doesn't need to flush to storage. Writing to SQLite requires that the data be flushed to wherever the SQLite data base is stored, which can take a significant amount of time. Reads can also be slow. (This is why StrictMode mode will normally alert about SQLite writes on the UI thread.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM