Created
March 6, 2019 13:21
-
-
Save developer-sdk/852f3290766ed0c339916a68e6519833 to your computer and use it in GitHub Desktop.
scala, 시간경과 확인
This file contains hidden or 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
| import java.util.concurrent.TimeUnit.NANOSECONDS | |
| def time[T](f: => T): T = { | |
| val start = System.nanoTime() | |
| val ret = f | |
| val end = System.nanoTime() | |
| // scalastyle:off println | |
| println(s"Time taken: ${NANOSECONDS.toMillis(end - start)} ms") | |
| // scalastyle:on println | |
| ret | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment