Last active
September 27, 2018 14:31
-
-
Save aphexmunky/4538612 to your computer and use it in GitHub Desktop.
benchmark closure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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