Daggervsroboguice

Demo projects used to test startup time between a dagger-based project and a RoboGuice-based project
Alternatives To Daggervsroboguice
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Vim Startuptime162
10 months ago8December 06, 2022mitGo
A small Go program for better `vim --startuptime` alternative
Startuptime.vim132
6 years ago8mitVim script
Breakdown Vim's --startuptime output
React Native Startup Time10212a month ago8August 14, 20224mitJava
measure startup time of your react-native app
Lambda Test79
8 years ago1mitShell
Test (pseudo) AWS runtime startup time
Startup Time19
4 years agoepl-2.0Clojure
Clojure startup time example
Node Coffee Cache19
9 years ago2mitJavaScript
Caches the contents of required CoffeeScript files so that they are not recompiled to help improve startup time
Vim Plugins Profiler15
a month ago6August 15, 2021Python
Utility to output a sorted list of VIM plugin startup times in millisec.
Zsh Startup Timer14
7 years ago1mitPython
A zsh plugin to print the time it takes for the shell to start up
Startup Time13
3 years ago5September 11, 2019artistic-2.0Ruby
A command-line benchmarking tool to measure the startup times of programs in various languages
Daggervsroboguice10
10 years agoJava
Demo projects used to test startup time between a dagger-based project and a RoboGuice-based project
Alternatives To Daggervsroboguice
Select To Compare


Alternative Project Comparisons
Readme

Summary

This project was created to compare start and injection times required to support dependency injection with both the RoboGuice and dagger DI libraries.

BaseProject

One base project defines 30 interfaces and 29 implementations, each injecting the next. This leads to a linear chain of dependencies, 30 classes deep. At this time there are no circular dependencies or other complexities in the dependency tree. The 30th implementation is left for consumers to define, though the dependent implementation requests injection from the base project.

Dagger & RoboGuice Projects

The other two projects are implemented with the same functionality using different DI libraries. RoboTest uses RoboGuice 2.0 and Dagger uses the latest dagger implementation.

Build it

Prerequisites

Java JDK 1.6+ maven 3+ Android SDK 16+ git

Build dagger

git clone git://github.com/square/dagger.git

cd dagger

mvn install

Build BaseProject

from BaseProject, run mvn install

Build RoboTest

from RoboTest, run mvn install

Deploy to a connected device with mvn android:deploy

Build DaggerTest

from DaggerTest, run mvn install

Deploy to a connected device with mvn android:deploy

Results

RoboGuice, as expected, has a larger start up cost due to its run-time module executing and binding validation. Dagger does its validation at compile time, removing nearly all of that cost at start up.

Running the built APKs from this source gets the following results:

  • DaggerTest: 62ms average start up time with 16 runs.
  • RoboTest: 403ms average start up time with 16 runs.

Additional profiling found that setContentView takes ~35ms for both applications with onCreate using up the remaining time. So operating under the assumption that onCreate is only spending time instantiating and providing / injecting objects:

  • dagger: ~25ms
  • RoboGuice: ~365ms

Disclaimer

Keep in mind that RoboGuice is preparing itself to provide much more than the 30 classes we've defined for this test (services, contexts, etc.), so this isn't quite an apples to apples test; more of an apple pie to apples comparison. Perhaps a Guice vs. Dagger comparison would be more apt, but until we have a RoboDagger (sounds painful), this will have to suffice. That said, I've done profiling of RoboGuice and its initialization cold start is a direct result of its use of Guice. That 400ms startup cost can be traced to Guice's module execution and binding validation, not the RoboGuice code that wraps it.

Popular Time Projects
Popular Startup Projects
Popular Libraries Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Java
Time
Apple
Startup
Dagger
Guice