Skip to content

Instantly share code, notes, and snippets.

@Jand42
Created January 5, 2016 07:36
Show Gist options
  • Select an option

  • Save Jand42/4766d0b68eecd29ed3bb to your computer and use it in GitHub Desktop.

Select an option

Save Jand42/4766d0b68eecd29ed3bb to your computer and use it in GitHub Desktop.
FCS compilation time testing
open System.Diagnostics
open System.IO
let ( +/ ) a b = Path.Combine(a, b)
let fcsRepoDir = @"C:\repos\FSharp.Compiler.Service" // set to a folder with FCS built
let fscExe = @"C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\fsc.exe"
let fsc40Exe = fcsRepoDir +/ @"bin\v4.0\FscExe.exe"
let fsc45Exe = fcsRepoDir +/ @"bin\v4.5\FscExe.exe"
let args = "" // set args for the project you would like to test
System.Environment.CurrentDirectory <- "" // set to project directory
let run exe message =
printfn "%s" message
let proc =
let startInfo =
ProcessStartInfo(exe, args,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true)
new Process(StartInfo = startInfo)
proc.OutputDataReceived.Add ignore
proc.ErrorDataReceived.Add ignore
proc.Start() |> ignore
proc.BeginOutputReadLine()
proc.BeginErrorReadLine()
proc.WaitForExit()
printfn "Running time: %A, Exit code: %d" (proc.ExitTime - proc.StartTime) proc.ExitCode
printfn "Total processor time: %A" proc.TotalProcessorTime
run fscExe "Building with original fsc"
run fsc40Exe "Building with FCS 4.0"
run fsc45Exe "Building with FCS 4.5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment