从 SD 卡读取图像 (jpeg) 文件与 SQLite DB 的比较
有谁知道(数字?)显示从 SQLite 数据库读取图像文件与直接从 SD 卡中的文件系统读取图像文件之间的区别。哪一个更快?
Does anyone have any idea (numbers?) that shows the difference between reading image files from a SQLite database vs reading it directly from the file system in a SD card. Which one is faster ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为直接从文件系统读取更快,因为从数据库读取包括从数据库文件读取数据。但是,它很大程度上取决于图像文件的大小。通常,数据库使用页面从磁盘(或在您的情况下从 SD 卡)读取数据。如果文件较小,从文件系统读取的效率可能会较低。
但是,当然,您需要对类似于系统中真实数据怀疑的数据进行原型设计和测试,这只会给您一个真实的答案。
I think reading from file system directly is faster, because reading from database includes reading data from database file. But, it greatly depends of image file size. Usually, database reads data from disk (or from SD Card in your case) using pages. Reading from file system may be less effective if file size is small.
But of course, you need to prototype and test it on your data similar to real data suspecting in system, this will get you only one true answer.
从文件系统读取总是比从数据库读取要快,除非数据库可以将文件缓存在内存中(不要认为 Android 手机有足够的内存让 sqllite 执行此操作)...
Reading from the file system is always faster than reading from a DB unless the DB can cache the file in memory (don't think Android phones have enough memory for sqllite to do this)...