如果在同一进程中使用 ContentProvider 有什么缺点

What is the downside if using ContentProvider within the same process

我想知道在同一进程中查询内容提供商是否会产生额外费用。我知道内容提供者正在通过活页夹处理数据,活页夹服务和活页夹客户端之间的所有数据转换都将通过内核中的活页夹驱动程序传递space。

我怀疑它是否仍然使用相同的方法,而我们在同一进程中使用内容提供者,因此导致额外的开销,例如延迟、额外的计算...等

场景是这样的——在多进程应用中,你通常会要求你的存储系统使用binder系统在进程间传递数据,但同时你也需要在同一个进程内传递数据过程。

如果您有一个多进程 android 应用程序,常用方法是什么?目前,我知道第三方解决方案 MMKV 但我不确定是否有官方解决方案来避免这种开销(如果它存在的话)。

I am wondering if there'll be extra cost to query content provider within the same process

与简单地调用对象上的方法相比,使用 ContentProvider 肯定会产生开销。 Inter-process 通信(IPC)不是免费的。这是对严重依赖 ContentProvider.

的存储访问框架性能的抱怨的原因之一。

ContentProvider 与消费者在同一个进程中这一事实不应消除此开销。