title: Execution time zero for non-trivial code golang
body: <pre><code>package main
  
  import (
  &quot;fmt&quot;
  &quot;time&quot;
  )
  
  func main() {
      time1 := time.Now()
      f := 0
      g := 0
      h := 0
      for i := 0; i &lt; 1000000; i++ {
          f += 1
          g += f*2 + (f*f) + (f*f*f*f*f)
          h += g*g*g + f*f
      }
      time2 := time.Now()
      second2 := time2.Sub(time1)
      fmt.Println(second2.Nanoseconds())
  }
  </code></pre>
  <p>This is printing <code>0</code> as output. I also added some print statements to add IO time, then also <code>0</code> was the output.
  Can someone explain why this is so?
  Link: <a href="https://play.golang.org/p/GUy9geJXBUA" rel="nofollow noreferrer">https://play.golang.org/p/GUy9geJXBUA</a></p>