Created
September 22, 2012 10:35
-
-
Save palladin/3765785 to your computer and use it in GitHub Desktop.
raise vs Async.Raise
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
type Microsoft.FSharp.Control.Async with | |
static member Raise (e : #exn) = Async.FromContinuations(fun (_,econt,_) -> econt e) | |
#time | |
for i in [|1..1000000|] do | |
try | |
raise <| new System.Exception() | |
with ex -> () | |
async { | |
for i in [|1..1000000|] do | |
try | |
return! Async.Raise <| new System.Exception() | |
with ex -> () | |
} |> Async.RunSynchronously |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment