Skip to content

Instantly share code, notes, and snippets.

@dmjio
Created August 29, 2011 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmjio/1177472 to your computer and use it in GitHub Desktop.
Save dmjio/1177472 to your computer and use it in GitHub Desktop.
Calculating all factorials of numbers 1 to 51,000
open System
open System.Diagnostics
let rec fac x = if x < 1.0 then 1.0 else x * fac(x-1.0)
let watch = new Stopwatch()
watch.Start()
let complexComputation = Async.Parallel [for i in 0.0..51000.0 -> async { return fac(i) }] |> Async.RunSynchronously;;
watch.Stop()
let result = watch.Elapsed.Seconds.ToString()
printfn "%s" result;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment