这将使用更多的内存?阵VS SQLite的(Android版) [英] Which would use more memory? Array vs SQLite (Android)

查看:105
本文介绍了这将使用更多的内存?阵VS SQLite的(Android版)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我制定,在某些时候需要选择任意类型的词的应用程序。例如,一个按钮将是pressed并且它需要检索也许两个形容词,名词,和三个动词,随机。我已经开始考虑如何建立一个SQ数据库LITE,但我开始怀疑,它会占用更多的内存和稍慢建立这个数据库或代替我能不能建立一些基本的字符串数组?感谢您提前帮助!

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!

推荐答案

除非你想持久保存数据我说你应该可能只是使用一个数组。数据库是多为持久性存储(即你需要在你的应用程序的多个运行的东西)。也就是说,如果你的阵列开始得到reeeeeeeeeealy *大,那么是啊,你会希望他们移动到磁盘(在这种情况下,他们不会占用任何内存)。而且可能做到这一点的最简单方法是使用数据库。

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.

*在成千上万entrys的大小,顺序甚至更多。

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

这篇关于这将使用更多的内存?阵VS SQLite的(Android版)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆