Created
          August 8, 2012 09:19 
        
      - 
      
- 
        Save mariussoutier/3293709 to your computer and use it in GitHub Desktop. 
    Executes a given block of code and prints the elapsed time
  
        
  
    
      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
    
  
  
    
  | def time[T](block: => T): T = { | |
| val start = System.currentTimeMillis | |
| val res = block | |
| val totalTime = System.currentTimeMillis - start | |
| println("Elapsed time: %1d ms".format(totalTime)) | |
| res | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment