Resources | Resources |



Performance considerations

The following performance considerations should be taken into account when using gallery features in Brew MP applications.

Database concurrency is a tricky problem, and the "correct" solution depends strongly on the use cases of a particular application. Because Gallery is a framework component used by many other applications, including background daemons that need to update the database, a complete solution requires a number of cooperating features. The following sections describe specific use cases and the corresponding features that enable that level of concurrency.

Limit mounted directories

Gallery clients can achieve better performance by limiting the number of directories mounted by the Gallery. Limiting the number of mounted directories effectively limits the number of files and directories that the Gallery must operate over, thus improving performance. For example, if an application displays files on a removable media card (fs:/card0) and the device drive (fs:/shared) separately, it is much more efficient for the application to use two instances of Gallery -- one mounted to fs:/card0 for querying fs:/card0 files, and the other for mounting and querying fs:/shared files.

For clients: proceed during synchronization

Gallery synchronization operations take can take a long time. Applications should register for "sync complete" notifications and proceed with normal operations while synchronization operations are in progress. When the application receives the "sync complete" notification, it can refresh.