本文介绍了Guice在Android上的表现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Java开发人员,我已经习惯于在应用程序中提供依赖注入。对于Android而言,我特别警惕性能。在Android应用中使用Guice有什么性能影响?我假设有一些开销,但它是否足够重要,我应该避免使用Guice?



我使用它可能只是将一些共享对象注入到各种

解决方案

从版本3开始,Guice缓存反射对象以提高性能。至少对dalvik进行注释查找更快,但目前的表现是可行的。


As a Java developer I've become accustomed to having dependency injection available in applications. For Android though, I am especially wary of performance. What are the performance implications for using Guice in an Android app? I assume there is some overhead, but is it significant enough that I should avoid using Guice?

My use of it would likely just be to inject a few shared objects into various activities.

解决方案

As of version 3, Guice caches reflective objects to improve performance. There's at least one bug out against dalvik to make annotation lookups faster, but the current performance is workable.

这篇关于Guice在Android上的表现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 17:39