Skip to content

Instantly share code, notes, and snippets.

View jponge's full-sized avatar

Julien Ponge jponge

View GitHub Profile
module GoloUndertow
function main = |args| {
let counter = java.util.concurrent.atomic.AtomicInteger()
let server = io.undertow.Undertow.builder():
addListener(8080, "localhost"):
setHandler(|exchange| {
exchange: getResponseHeaders(): put(io.undertow.util.Headers.CONTENT_TYPE(), "text/plain")
exchange: getResponseSender(): send("Golo World #" + counter: incrementAndGet())
}): build()
messages = ["Golo will rock you", "Emmanuel Lecharny needs some Scala love"]
printer = (what) ->
console.log(what)
for msg in messages
do (msg) -> printer(msg)
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running closure.CallClosureTest
CallClosureTest.groovy: [measured 5 out of 15 rounds, threads: 1 (sequential)]
round: 1.16 [+- 0.03], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 15, GC.time: 0.02, time.total: 18.18, time.warmup: 12.38, time.bench: 5.80
CallClosureTest.java_unboxed: [measured 5 out of 15 rounds, threads: 1 (sequential)]
round: 0.24 [+- 0.01], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 7, GC.time: 0.01, time.total: 3.58, time.warmup: 2.38, time.bench: 1.20
CallClosureTest.java_boxed: [measured 5 out of 15 rounds, threads: 1 (sequential)]
round: 0.25 [+- 0.01], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 8, GC.time: 0.01, time.total: 3.82, time.warmup: 2.55, time.bench: 1.27
diff --git a/pom.xml b/pom.xml
index ce4561e..1fe4972 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
<version>7</version>
</parent>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
@jponge
jponge / Fibonacci.java
Created April 16, 2013 12:54
Memoization with invokedynamic
/*
* Copyright (C) 2013 Julien Ponge
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
@jponge
jponge / Except.java
Last active December 13, 2015 18:58
import java.io.IOException;
public class Except {
static void a() throws Exception {
try {
b();
} catch (IOException e) {
throw new Exception("woops", e);
} finally {
class Const {
public void foo() {
final int x = 10;
int y = x;
}
public void bar() {
int x = 10;
int y = x;
file = "jooflux-ecoop13"
task :default => [:compile] do
end
task :pdf => :compile
task :compile do
system "pdflatex -interaction=nonstopmode #{file}.tex"
system "bibtex #{file}"
@jponge
jponge / Foo.java
Created November 12, 2012 14:26
Bytecode quizz
public class Foo extends SomeClass implements SomeInterface {
public static void main(java.lang.String[]);
Code:
0: new #2 // class Foo
3: dup
4: invokespecial #12 // Method "<init>":()V
7: return
public Foo();
Code:
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
export PATH=$JAVA_HOME/bin:$PATH