在提高机器人的意图成本 [英] Cost of raising an Intent in android
问题描述
多少性能它的成本广播意图? 难道没关系广播多路每秒或有意向贵?
How much performance does it costs to broadcast intents? Is it okay to broadcast multiple per second or are intents expensive?
推荐答案
意图是为了推出了Android操作系统中不同的活动,或以通知的基本动作。这似乎是一个不好的设计模式使用它们,否则。由于它们不同进程之间传播,从而实现Parcelable界面,他们都不是最轻量级的。
Intents are meant to launch different activities within the Android OS or to inform about basic actions. It seems like a bad design pattern to use them otherwise. As they travel between different processes and therefore implement the Parcelable interface, they are not the most light-weight.
如果你正在寻找你可能会考虑使用一个共同的服务,同时更新不同的活动。
If you are looking to update different activities at the same time you might consider using a common service.
根据这一博客帖子,意图是10倍,比直接的函数调用速度较慢 <一href="http://andytsui.word$p$pss.com/2010/09/14/android-intent-performance/">http://andytsui.word$p$pss.com/2010/09/14/android-intent-performance/
According to this blog post, intents are 10 times slower than direct function calls http://andytsui.wordpress.com/2010/09/14/android-intent-performance/
这篇关于在提高机器人的意图成本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!