Derek
Derek

Reputation: 63

Which would use more memory? Array vs SQLite (Android)

So, I am developing an app that at some point needs to choose random types of words. For example, a button will be pressed and it needs to retrieve maybe two adjectives, a noun, and three verbs, randomly. I have started looking at how to set-up a SQ LITE database, but I'm starting to wonder, would it take up more memory and be slightly slower to set up this database or instead could I just set-up a few basic String arrays? Thank you for the help in advance!

Upvotes: 1

Views: 1426

Answers (1)

Kurtis Nusbaum
Kurtis Nusbaum

Reputation: 30825

Unless you want to store the data persistently I'd say you should probably just use an Array. Databases are more for persistent storage (i.e. stuff you'll need over multiple runs of your app). That said, if you arrays start getting reeeeeeeeeealy* big, then yea you're going to want to move them onto disk (in which case they won't take up any memory). And probably the simplest way to do that is with a database.

*On the order of magnitude of hundreds of thousands of entrys, maybe even more.

Upvotes: 2

Related Questions