Skip to content

Instantly share code, notes, and snippets.

@melix
Created April 17, 2015 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melix/e1b391ac2f1682518109 to your computer and use it in GitHub Desktop.
Save melix/e1b391ac2f1682518109 to your computer and use it in GitHub Desktop.
Alternate build.gradle file for model-class-benchmark to test Groovy snapshot
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.11.91.1'
}
}
plugins {
id 'me.champeau.gradle.jmh' version '0.2.0'
}
apply plugin: 'groovy'
apply plugin: 'scala'
apply plugin: 'kotlin'
apply plugin: 'idea'
tasks.withType(GroovyCompile) {
groovyOptions.optimizationOptions.indy = true
}
repositories {
jcenter()
maven { url 'https://oss.jfrog.org/oss-snapshot-local' }
}
jmh {
jmhVersion = '1.8'
warmupIterations = 15
iterations = 30
fork = 1
humanOutputFile = null // show benchmark on console
}
dependencies {
//compile 'org.codehaus.groovy:groovy-all:2.4.3:indy' // indy will kill optimizations when used in combination with @CompileStatic
compile 'org.codehaus.groovy:groovy:2.4.4-SNAPSHOT'
compile 'org.projectlombok:lombok:1.16.2'
compile 'com.google.auto.value:auto-value:1.0'
compile 'org.scala-lang:scala-library:2.11.6'
compile 'org.scala-lang:scala-compiler:2.11.6'
compile 'org.jetbrains.kotlin:kotlin-stdlib:0.11.91.1'
compile fileTree(dir: 'lib', include: '*.jar')
}
idea {
module {
scopes.PROVIDED.plus += [configurations.jmh]
}
}
task measureMemory(type: JavaExec) {
main = 'com.netflix.model.ModelMeasurer'
classpath = sourceSets.jmh.runtimeClasspath
jvmArgs = ["-javaagent:${file('lib/object-explorer.jar')}"]
}
@melix
Copy link
Author

melix commented Apr 17, 2015

Result on my computer for hashCode:

Benchmark                     (model)  Mode  Cnt    Score   Error  Units
ModelBenchmark.hashCode      intellij  avgt   30   26.039 ± 0.192  ns/op
ModelBenchmark.hashCode       eclipse  avgt   30   26.829 ± 0.543  ns/op
ModelBenchmark.hashCode        groovy  avgt   30  100.782 ± 0.976  ns/op
ModelBenchmark.hashCode  staticgroovy  avgt   30   25.693 ± 0.222  ns/op
ModelBenchmark.hashCode        lombok  avgt   30   27.522 ± 3.517  ns/op
ModelBenchmark.hashCode         scala  avgt   30   46.357 ± 0.404  ns/op
ModelBenchmark.hashCode        kotlin  avgt   30   26.701 ± 0.444  ns/op
ModelBenchmark.hashCode     autovalue  avgt   30   25.306 ± 0.439  ns/op

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment