https://github.com/andrus/di-comparison
DI containers comparison
https://github.com/andrus/di-comparison
dependency-injection
Last synced: about 1 year ago
JSON representation
DI containers comparison
- Host: GitHub
- URL: https://github.com/andrus/di-comparison
- Owner: andrus
- Created: 2018-03-31T12:45:56.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T17:43:46.000Z (about 2 years ago)
- Last Synced: 2024-05-07T18:29:22.288Z (about 2 years ago)
- Topics: dependency-injection
- Language: Java
- Homepage:
- Size: 78.1 KB
- Stars: 20
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DI Containers Comparision
Comparing a simple app varieties on different DI containers.
## IntelliJ IDEA Setup
Go to "Preferences > Annotation Processors", and check "Enable Annotation
Processing".
## "Benchmark"
```
# Build (can't compare build times, as module ordering affects the results)
mvn clean package
```
### File sizes
```
find . -name '*.jar' |xargs ls -l |grep -v original |grep -v common
```
### Execution time
```
time java -jar ./bootique/target/bootique-*.jar
time java -jar ./cayennedi/target/cayennedi-*.jar
time java -jar ./dagger/target/dagger-*.jar
time java -jar ./guice/target/guice-*.jar
time java -jar ./owb/target/owb-*.jar
time java -jar ./spring/target/spring-*.jar
time java -jar ./springboot/target/springboot-*.jar
```
## Results (Java 21)
_MacBook Pro 2021 M1, 16GB RAM, OpenJDK Temurin-21+35_
|DI| Jar w/Deps Size, KB | :arrow_down: Exec time, ms |
|----|---------------------|----------------------------|
|Dagger| 58 | 90 |
|Cayenne DI| 71 | 105 |
|Bootique| 2894 | 157 |
|Guice| 3827 | 204 |
|OpenWebBeans| 1632 | ? (failures) |
|Spring| 4800 | 221 |
|Spring Boot| 10094 | 743 |