Skip to content

Instantly share code, notes, and snippets.

@aphexmunky
Last active September 27, 2018 14:31
Show Gist options
  • Save aphexmunky/4538612 to your computer and use it in GitHub Desktop.
Save aphexmunky/4538612 to your computer and use it in GitHub Desktop.
benchmark closure
def benchmark = { closure ->
start = System.currentTimeMillis()
closure.call()
now = System.currentTimeMillis()
now - start
}
def originalTime = benchmark {
productList.each { productId ->
def param = [productId]
sql.execute('''some sql where product_id = ?''', param)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment