Last active
December 20, 2015 21:49
-
-
Save jimfulton/6200533 to your computer and use it in GitHub Desktop.
Stupid little timer for timing grizzled.io.RichInputStream.copyTo.
Meant to be run from the sbt console. sample-session shows a sample session copying a file named "src" to a file named "dest".
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
bash-3.2$ sbt console | |
scala> :load streamtimer.scala | |
scala> f("src", "dest") |
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 timeit(f: => Unit): Long = { | |
val t = System.currentTimeMillis() | |
f | |
System.currentTimeMillis() - t | |
} | |
import grizzled.file.util._ | |
import java.io.File | |
def f(src: String, dest: String) : Unit = { | |
val s = new File(src) | |
val d = new File(dest) | |
println(timeit { copyFile(s, d) }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment