Created
          August 25, 2020 06:56 
        
      - 
      
- 
        Save jasonsturges/afe7ea043fe07bc3449f8c4efb114485 to your computer and use it in GitHub Desktop. 
    Benchmarking JavaScript - Setting up a timer
  
        
  
    
      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
    
  
  
    
  | let iterations = 100000; | |
| let startTime = new Date().getTime(); | |
| for (let i = 0; i < iterations; i++) | |
| Math.log10(0) | |
| let endTime = new Date().getTime(); | |
| let time = endTime - startTime; | |
| console.info(`time: ${time}ms, op: ${time / iterations}ms`); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment