Skip to content

Commit

Permalink
Migrate to Gradle, add komodo and baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
IRus committed Jan 11, 2021
1 parent 7c8949d commit 8816c0e
Show file tree
Hide file tree
Showing 34 changed files with 564 additions and 554 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.iml
.idea
target
dependency-reduced-pom.xml
out
build
.gradle
.DS_Store
52 changes: 32 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,48 @@ Processing".
## "Benchmark"

```
# Build (can't compare build times, as module ordering affects the results)
mvn clean package
# Build
./gradlew clean build installDist distTar
```

```
# Get the file sizes
find . -name '*.jar' |xargs ls -l |grep -v original |grep -v common
find . -name '*.tar' |xargs ls -lh |grep -v original |grep -v common
```

```
# Execution time
time java -jar ./bootique2/target/bootique2-*.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
time (for i in {1..10}; do ./baseline/build/install/baseline/bin/baseline; done)
time (for i in {1..10}; do ./bootique2/build/install/bootique2/bin/bootique2; done)
time (for i in {1..10}; do ./cayennedi/build/install/cayennedi/bin/cayennedi; done)
time (for i in {1..10}; do ./dagger/build/install/dagger/bin/dagger; done)
time (for i in {1..10}; do ./guice/build/install/guice/bin/guice; done)
time (for i in {1..10}; do ./komodo/build/install/komodo/bin/komodo; done)
time (for i in {1..10}; do ./owb/build/install/owb/bin/owb; done)
time (for i in {1..10}; do ./spring/build/install/spring/bin/spring; done)
time (for i in {1..10}; do ./springboot/build/install/springboot/bin/springboot; done)
time (for i in {1..10}; do ./springboot/build/install/springboot/bin/springboot; done)
time (for i in {1..10}; do ./spring/build/install/spring/bin/spring; done)
time (for i in {1..10}; do ./owb/build/install/owb/bin/owb; done)
time (for i in {1..10}; do ./komodo/build/install/komodo/bin/komodo; done)
time (for i in {1..10}; do ./guice/build/install/guice/bin/guice; done)
time (for i in {1..10}; do ./dagger/build/install/dagger/bin/dagger; done)
time (for i in {1..10}; do ./cayennedi/build/install/cayennedi/bin/cayennedi; done)
time (for i in {1..10}; do ./bootique2/build/install/bootique2/bin/bootique2; done)
time (for i in {1..10}; do ./baseline/build/install/baseline/bin/baseline; done)
```

## Results (Java 8)
## Results (JDK 11)

|DI|Jar w/Deps Size, KB|:arrow_down: Exec time, ms|
|DI|Jar w/Deps Size, Mb|:arrow_down: Exec time, s|
|----|-----|----|
|Dagger|46|104|
|Cayenne DI|79|120|
|Bootique 2|2522|244|
|Guice|3781|328|
|OpenWebBeans|1345|381|
|Spring|3954|355|
|Spring Boot|7824|1057|
|Baseline|1.7|1.35|
|Dagger|1.7|1.41|
|Cayenne DI|1.8|2.05|
|Bootique 2|4.2|4.31|
|Guice|5.4|6.22|
|Komodo|6.4|7.56|
|Spring|5.5|8.36|
|OpenWebBeans|3.0|10.02|
|Spring Boot|9.2|26.94|
18 changes: 18 additions & 0 deletions baseline/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
kotlin("jvm").version("1.4.30-M1")
application
}

application {
mainClass.set("org.objectstyle.baseline.MainKt")
}

repositories {
jcenter()
}

dependencies {
implementation(project(":common"))

implementation(kotlin("stdlib-jdk8"))
}
10 changes: 10 additions & 0 deletions baseline/src/main/java/org/objectstyle/baseline/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.objectstyle.baseline

import org.objectstyle.di.service.ServiceImpl
import org.objectstyle.di.service.SubServiceImpl

fun main() {
val s = ServiceImpl(SubServiceImpl())

println(s.doIt())
}
21 changes: 21 additions & 0 deletions bootique2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
java
application
}

application {
mainClass.set("org.objectstyle.bootique2.Main")
}

repositories {
jcenter()
maven {
url = uri("https://maven.objectstyle.org/nexus/content/repositories/bootique-snapshots/")
}
}

dependencies {
implementation(project(":common"))

implementation("io.bootique:bootique:2.0-SNAPSHOT")
}
52 changes: 0 additions & 52 deletions bootique2/pom.xml

This file was deleted.

Empty file added build.gradle.kts
Empty file.
18 changes: 18 additions & 0 deletions cayennedi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
java
application
}

application {
mainClass.set("org.objectstyle.cayenne.Main")
}

repositories {
jcenter()
}

dependencies {
implementation(project(":common"))

implementation("org.apache.cayenne:cayenne-di:4.1.RC2")
}
42 changes: 0 additions & 42 deletions cayennedi/pom.xml

This file was deleted.

11 changes: 11 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
kotlin("jvm").version("1.4.30-M1")
}

repositories {
jcenter()
}

dependencies {
implementation(kotlin("stdlib-jdk8"))
}
16 changes: 0 additions & 16 deletions common/pom.xml

This file was deleted.

8 changes: 3 additions & 5 deletions common/src/main/java/org/objectstyle/di/service/Service.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.objectstyle.di.service;
package org.objectstyle.di.service


public interface Service {

String doIt();
interface Service {
fun doIt(): String
}
17 changes: 6 additions & 11 deletions common/src/main/java/org/objectstyle/di/service/ServiceImpl.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package org.objectstyle.di.service;
package org.objectstyle.di.service

public class ServiceImpl implements Service {

private SubService subService;

public ServiceImpl(SubService subService) {
this.subService = subService;
}

public String doIt() {
return "ServiceImpl_" + subService.doIt();
class ServiceImpl(
private val subService: SubService
) : Service {
override fun doIt(): String {
return "ServiceImpl_" + subService.doIt()
}
}
6 changes: 3 additions & 3 deletions common/src/main/java/org/objectstyle/di/service/SubService.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.objectstyle.di.service;
package org.objectstyle.di.service

public interface SubService {
String doIt();
interface SubService {
fun doIt(): String
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.objectstyle.di.service;
package org.objectstyle.di.service

public class SubServiceImpl implements SubService {

public String doIt() {
return "SubServiceImpl";
class SubServiceImpl : SubService {
override fun doIt(): String {
return "SubServiceImpl"
}
}
19 changes: 19 additions & 0 deletions dagger/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
java
application
}

application {
mainClass.set("org.objectstyle.dagger.Main")
}

repositories {
jcenter()
}

dependencies {
implementation(project(":common"))

implementation("com.google.dagger:dagger:2.30.1")
annotationProcessor("com.google.dagger:dagger-compiler:2.30.1")
}
47 changes: 0 additions & 47 deletions dagger/pom.xml

This file was deleted.

Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading

0 comments on commit 8816c0e

Please sign in to comment.