Skip to content

Instantly share code, notes, and snippets.

@melix
Created February 1, 2012 12:13
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/1716776 to your computer and use it in GitHub Desktop.
Save melix/1716776 to your computer and use it in GitHub Desktop.
Proxy generation benchmark
interface Foo {}
abstract class AbstractFoo {}
abstract class SingleAbstract { abstract int foo() }
def tests = [
'mapAsAbstractClass': { [:] as AbstractFoo },
'mapWithOneMethodAsAbstractClass': { ['foo': { 1 } ] as SingleAbstract }
]
tests.each { name, test ->
long sd = System.currentTimeMillis()
1000.times { test() }
long dur = System.currentTimeMillis()-sd
println "$name: ${dur}ms"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment