Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Time-a-function/Groovy/time-a-function-3.groovy
Normal file
11
Task/Time-a-function/Groovy/time-a-function-3.groovy
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
def countTo = { Long n ->
|
||||
long i = 0; while(i < n) { i += 1L }
|
||||
}
|
||||
|
||||
["CPU time":clockCpuTime, "wall clock time":clockRealTime].each { measurementType, timer ->
|
||||
println '\n'
|
||||
[100000000L, 1000000000L].each { testSize ->
|
||||
def measuredTime = timer(countTo.curry(testSize))
|
||||
println "Counting to ${testSize} takes ${measuredTime}ms of ${measurementType}"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue