1 Star 1 Fork 0

compilelife / EventBus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
COMPARISON.md 2.86 KB
一键复制 编辑 原始数据 按行查看 历史
Markus 提交于 2016-02-01 22:04 . prepping v3.0.0

EventBus Comparison

Comparison with Square's Otto

Otto is another event bus library for Android; actually it's a fork of Guava's EventBus. greenrobot's EventBus and Otto share some basic semantics (register, post, unregister, ...), but there are differences which the following table summarizes:

EventBus Otto
Declare event handling methods Annotations (since 3.0, can be precompiled for best performance) Annotations
Event inheritance Yes Yes
Subscriber inheritance Yes No
Cache most recent events Yes, sticky events No
Event producers (e.g. for coding cached events) No Yes
Event delivery in posting thread Yes (Default) Yes
Event delivery in main thread Yes No
Event delivery in background thread Yes No
Asynchronous event delivery Yes No

Note: the following information is outdated, preprocessed annotations are much faster than EventBus 2.x, on which the following table is based.

Besides features, performance is another differentiator. To compare performance, we created an Android application, which is also part of this repository (EventBusPerformance). You can also run the app on your phone to benchmark different scenarios.

TODO: Update for EventBus 3 with and without index.

Benchmark results indicate that EventBus is significantly faster in almost every scenario:

EventBus Otto
Posting 1000 events, Android 2.3 emulator ~70% faster
Posting 1000 events, S3 Android 4.0 ~110% faster
Register 1000 subscribers, Android 2.3 emulator ~10% faster
Register 1000 subscribers, S3 Android 4.0 ~70% faster
Register subscribers cold start, Android 2.3 emulator ~350% faster
Register subscribers cold start, S3 Android 4.0 About the same
1
https://gitee.com/compilelife/EventBus.git
git@gitee.com:compilelife/EventBus.git
compilelife
EventBus
EventBus
master

搜索帮助