title: What is the effect of "if false then ()" in the Computer Language Benchmarks Game's F# Threadring entry?
body: <p>The Computer Language Benchmarks Game's <a href="http://benchmarksgame.alioth.debian.org/u64q/program.php?test=threadring&amp;lang=fsharp&amp;id=3" rel="nofollow noreferrer">F# entry for Threadring</a> contains a seemingly useless line: <code>if false then ()</code>. When I comment out this line, the program runs much faster (~2s vs ~55s for an input of 50000000) and produces the same result. How does this work? Why is this line there? What exactly is the compiler doing with what appears to be a no-op?</p>
  
  <p>The code:</p>
  
  <pre><code>let ringLength = 503
  
  let cells = Array.zeroCreate ringLength
  let threads = Array.zeroCreate ringLength
  let answer = ref -1
  
  let createWorker i = 
      let next = (i+1)%ringLength
      async { let value = cells.[i]
              if false then () 
              match value with
              | 0 -&gt; answer := i+1
              | _ -&gt; 
                  cells.[next] &lt;- value - 1 
                  return! threads.[next] }
  
  [&lt;EntryPoint&gt;]
  let main args = 
      cells.[0] &lt;- if args.Length&gt;0 then int args.[0] else 50000000
      for i in 0..ringLength-1 do 
          threads.[i]&lt;-createWorker i
  
      let result = Async.StartImmediate(threads.[0])
      printfn "%d" !answer
      0
  </code></pre>