Skip to content

Instantly share code, notes, and snippets.

@davidgrenier
Last active August 29, 2015 14:05
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 davidgrenier/39b265dc2b1a8d68ef13 to your computer and use it in GitHub Desktop.
Save davidgrenier/39b265dc2b1a8d68ef13 to your computer and use it in GitHub Desktop.
#r @"C:\Projects\Streams\src\Streams.Core\bin\Release\Streams.Core.dll"
open Nessos.Streams.Core
let data =
[|
let rnd = System.Random().NextDouble >> (*) 1e3
for x in -10.0 .. 10.0 do
yield System.DateTime.Now.AddDays (rnd())
|]
#time;;
for x = 0 to 1000000 do
data
|> Stream.ofArray
|> Stream.sortBy (fun x -> System.DateTime.MaxValue - x)
|> Stream.tryFind (fun _ -> true)
|> ignore;;
for x = 0 to 1000000 do
data
|> Array.sortBy (fun x -> System.DateTime.MaxValue - x)
|> Array.tryFind (fun _ -> true)
|> ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment