forked from greenrobot/EventBus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved comparison to Otto into COMPARISON.md
- Loading branch information
1 parent
ccc2771
commit 837fc09
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
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: | ||
<table> | ||
<tr> | ||
<th></th> | ||
<th>EventBus</th> | ||
<th>Otto</th> | ||
</tr> | ||
<tr> | ||
<th>Declare event handling methods</th> | ||
<td>Name conventions</td> | ||
<td>Annotations</td> | ||
</tr> | ||
<tr> | ||
<th>Event inheritance</th> | ||
<td>Yes</td> | ||
<td>Yes</td> | ||
</tr> | ||
<tr> | ||
<th>Subscriber inheritance</th> | ||
<td>Yes</td> | ||
<td>No</td> | ||
</tr> | ||
<tr> | ||
<th>Cache most recent events</th> | ||
<td>Yes, sticky events</td> | ||
<td>No</td> | ||
</tr> | ||
<tr> | ||
<th>Event producers (e.g. for coding cached events)</th> | ||
<td>No</td> | ||
<td>Yes</td> | ||
</tr> | ||
<tr> | ||
<th>Event delivery in posting thread</th> | ||
<td>Yes (Default)</td> | ||
<td>Yes</td> | ||
</tr> | ||
<tr> | ||
<th>Event delivery in main thread</th> | ||
<td>Yes</td> | ||
<td>No</td> | ||
</tr> | ||
<tr> | ||
<th>Event delivery in background thread</th> | ||
<td>Yes</td> | ||
<td>No</td> | ||
</tr> | ||
<tr> | ||
<th>Aynchronous event delivery</th> | ||
<td>Yes</td> | ||
<td>No</td> | ||
</tr> | ||
</table> | ||
|
||
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. | ||
|
||
Benchmark results indicate that EventBus is significantly faster in almost every scenario: | ||
<table> | ||
<tr> | ||
<th></th> | ||
<th>EventBus</th> | ||
<th>Otto</th> | ||
</tr> | ||
<tr> | ||
<th>Posting 1000 events, Android 2.3 emulator</th> | ||
<td>~70% faster</td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<th>Posting 1000 events, S3 Android 4.0</th> | ||
<td>~110% faster</td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<th>Register 1000 subscribers, Android 2.3 emulator</th> | ||
<td>~10% faster</td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<th>Register 1000 subscribers, S3 Android 4.0</th> | ||
<td>~70% faster</td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<th>Register subscribers cold start, Android 2.3 emulator</th> | ||
<td>~350% faster</td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<th>Register subscribers cold start, S3 Android 4.0</th> | ||
<td colspan="2">About the same</td> | ||
</tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters