Skip to content

Instantly share code, notes, and snippets.

@melix
Created April 5, 2012 14:58
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/2311771 to your computer and use it in GitHub Desktop.
Save melix/2311771 to your computer and use it in GitHub Desktop.
diff --git a/build.gradle b/build.gradle
index 9102228..f774cfd 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,15 +5,17 @@ defaultTasks 'clean', 'test'
repositories {
mavenCentral()
mavenRepo name:"codehaus", url:"http://repository.codehaus.org/"
- mavenRepo name:"groovypp", url:"http://groovypp.artifactoryonline.com/groovypp/libs-releases-local"
+ //mavenRepo name:"groovypp", url:"http://groovypp.artifactoryonline.com/groovypp/libs-releases-local"
+ mavenRepo name:'spock-snapshots', url:'http://oss.sonatype.org/content/repositories/snapshots/'
}
dependencies {
//groovy 'org.codehaus.groovy:groovy:1.8.6'
- testCompile 'org.spockframework:spock-core:0.5-groovy-1.8', {
+ testCompile 'org.spockframework:spock-core:0.7-groovy-2.0-SNAPSHOT', {
exclude group:'org.codehaus.groovy', module:'groovy-all'
}
groovy 'com.googlecode.gbench:gbench:0.3.0-groovy-1.8'
- groovy 'org.mbte.groovypp:groovypp-all:0.9.0_1.8.2'
+ groovy files('/home/cchampeau/DEV/PROJECTS/OPENSOURCE/GROOVY/groovy-git/groovy-git/target/dist/groovy-all.jar')
+ //groovy 'org.mbte.groovypp:groovypp-all:0.9.0_1.8.2'
}
def defaultEncoding = 'UTF-8'
diff --git a/src/main/groovy/org/jggug/javaonetokyo/bof/bench/Benchmark.groovy b/src/main/groovy/org/jggug/javaonetokyo/bof/bench/Benchmark.groovy
index 6fe6f87..aa95770 100644
--- a/src/main/groovy/org/jggug/javaonetokyo/bof/bench/Benchmark.groovy
+++ b/src/main/groovy/org/jggug/javaonetokyo/bof/bench/Benchmark.groovy
@@ -1,33 +1,34 @@
package org.jggug.javaonetokyo.bof.bench
import gbench.*
+import groovy.transform.CompileStatic
class Benchmark {
- @Typed
+ @CompileStatic
static void putOnly(File file) {
RBTreeMap map = RBTreeMap.newInstance()
// put(key, value)
- file.eachLine { line ->
+ file.eachLine { String line ->
String[] cols = line.split(",") // key,value,height
map.put(cols[0], cols[1])
//assert map.height() == cols[2] as int
}
}
- @Typed
+ @CompileStatic
static void putAndGet(File file) {
- RBTreeMap map = RBTreeMap.newInstance()
+ RBTreeMap map = RBTreeMap.newMap()
// put(key, value)
- file.eachLine { line ->
+ file.eachLine { String line ->
String[] cols = line.split(",") // key,value,height
map.put(cols[0], cols[1])
//assert map.height() == cols[2] as int
}
// get(key)
- file.eachLine { line ->
+ file.eachLine { String line ->
String[] cols = line.split(",") // key,value,height
assert map.get(cols[0]) == cols[1]
}
diff --git a/src/main/groovy/org/jggug/javaonetokyo/bof/bench/RBTreeMap.groovy b/src/main/groovy/org/jggug/javaonetokyo/bof/bench/RBTreeMap.groovy
index 607831c..0ea00a4 100644
--- a/src/main/groovy/org/jggug/javaonetokyo/bof/bench/RBTreeMap.groovy
+++ b/src/main/groovy/org/jggug/javaonetokyo/bof/bench/RBTreeMap.groovy
@@ -1,8 +1,9 @@
package org.jggug.javaonetokyo.bof.bench
import java.lang.IllegalArgumentException as IAE
+import groovy.transform.CompileStatic
-@Typed
+@CompileStatic
class RBTreeMap {
private Node root = Node.EMPTY
@@ -24,10 +25,10 @@ class RBTreeMap {
@Override
String toString() { root.toString() }
- static newInstance() { new RBTreeMap() }
+ static RBTreeMap newMap() { new RBTreeMap() }
}
-@Typed
+@CompileStatic
abstract class Node {
protected final static int BLACK = 1
protected final static int RED = 0
@@ -157,7 +158,7 @@ abstract class Node {
}
}
-@Typed
+@CompileStatic
class FillNode extends Node {
FillNode(int color, String key, String value) {
setColor(color)
@@ -179,7 +180,7 @@ class FillNode extends Node {
}
}
-@Typed
+@CompileStatic
class EmptyNode extends Node {
@Override
Node put(String key, String value) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment