BLOB性能比较的问题

BLOB性能比较的问题

本文介绍了Android的源码/ BLOB性能比较的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我搬到从ArrayList中我的数据在Android SQLite数据库,我有一个严重的性能下降。有没有游标处于打开状态,可能会导致,所以我怀疑,这个问题是我存储在一个BLOB字段中的图像。

Ever since I moved my data from ArrayList to a sqlite database on Android, I have a serious performance drop. There are no cursors left open that could cause that, so I suspect that the problem is with the images I store in a BLOB field.

该应用程序创建的的是有一个字段的 cardBitmap 的是被填充在创建位图。

The application creates Cards that have a field cardBitmap that gets populated with a bitmap upon creation.

谁能告诉我,从他们的经验,有什么解决方案更高性能:

Can anyone tell me from their experience, what solution is more performant:

  1. cardBitmap 的持有引用(路径)到SD卡上的文件,将在创建时进行绘制。只有路径存储在数据库中。
  2. cardBitmap 的持有对象( BitmapFactory.de codeStream(的ImageStream,NULL,NULL)的),其中的的ImageStream 的读取为一个的 ByteArrayInputStream的的从相应的数据库字段。
  1. cardBitmap holds a reference (path) to a file on SDcard that will be drawn upon creation. Only path is stored in DB.
  2. cardBitmap holds an object (BitmapFactory.decodeStream(imageStream,null,null)), where imageStream is read as a ByteArrayInputStream from the corresponding database field.

任何建议将是有益的。谢谢!

Any suggestions would be helpful. Thanks!

推荐答案

您的第一种方法是最好的一个,使用从SD卡的文件,并存储参考路径的SQLite数据库,这使你更快性能也是你的数据库是保持重量轻。

Your first solution is better one, Use a file from sdcard and store the reference path in your sqlite database, This gives you faster performance and also your database is remain light weight.

这篇关于Android的源码/ BLOB性能比较的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 01:49