Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseApplication里面遍历application的代理类这块感觉要是类很多会耗性能 #26

Open
IdealMiracle opened this issue Sep 27, 2018 · 2 comments

Comments

@IdealMiracle
Copy link

大神求解:
mAppDelegateList = ClassUtils.getObjectsWithInterface(this, IApplicationDelegate.class, ROOT_PACKAGE);
这里查找对应包下面所有的类 进行遍历如果app的类过多是不是会耗性能呢?

因为代理类一般一个模块只有一个类你这边取名低MyDelegate
可否根据配置文件拿到主工程依赖的子模块名称 然后直接去找到对应的 package.model.MyDelegate呢?

@IdealMiracle
Copy link
Author

09-27 18:09:12.369 11253-11253/? E/耗时=45毫秒
09-27 18:09:12.369 11253-11253/? E/耗时=0毫秒

上面那行是你这个全局遍历的耗时 你这个项目工程不大 类不多 大型APP要是类很多 这个时间应该会多很多

下面那个是直接通过配置获取到对应模块下面的MyDelegate基本没有时间损耗

@holleQiang
Copy link

用字节码注入的方式可以解决问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants