Skip to content

Instantly share code, notes, and snippets.

@okram
Created November 4, 2012 19:01
Show Gist options
  • Save okram/4013090 to your computer and use it in GitHub Desktop.
Save okram/4013090 to your computer and use it in GitHub Desktop.
public void testStartupCosts() throws Exception {
final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
CompiledScript script1 = engine.compile("");
CompiledScript script2 = engine.compile("1+1");
int runs = 750;
long totalTime = 0l;
for (int i = 0; i < runs; i++) {
long time = System.currentTimeMillis();
//engine.eval("");
script1.eval();
totalTime += System.currentTimeMillis() - time;
}
System.out.println(totalTime);
totalTime = 0l;
for (int i = 0; i < runs; i++) {
long time = System.currentTimeMillis();
//engine.eval("1+1");
script2.eval();
totalTime += System.currentTimeMillis() - time;
}
System.out.println(totalTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment