Skip to content

Commit a846843

Browse files
authored
Merge pull request #75 from eulerfx/master
update release notes
2 parents 6d2dcbe + 0bae599 commit a846843

File tree

5 files changed

+130
-27
lines changed

5 files changed

+130
-27
lines changed

RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 2.0.17 - 21.11.2017
2+
* Improve performance of internal Async.chooseTasks function which improves performance of AsyncSeq.bufferByCountAndTime, etc (https://github.com/fsprojects/FSharp.Control.AsyncSeq/pull/73)
3+
4+
### 2.0.16 - 29.09.2017
5+
* Fix previous package deployment
6+
17
### 2.0.15 - 27.09.2017
28
* NEW: AsyncSeq.bufferByTime
39

src/FSharp.Control.AsyncSeq.Profile7/AssemblyInfo.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ open System.Reflection
44
[<assembly: AssemblyTitleAttribute("FSharp.Control.AsyncSeq.Profile7")>]
55
[<assembly: AssemblyProductAttribute("FSharp.Control.AsyncSeq")>]
66
[<assembly: AssemblyDescriptionAttribute("Asynchronous sequences for F#")>]
7-
[<assembly: AssemblyVersionAttribute("2.0.14")>]
8-
[<assembly: AssemblyFileVersionAttribute("2.0.14")>]
7+
[<assembly: AssemblyVersionAttribute("2.0.17")>]
8+
[<assembly: AssemblyFileVersionAttribute("2.0.17")>]
99
do ()
1010

1111
module internal AssemblyVersionInformation =
12-
let [<Literal>] Version = "2.0.14"
13-
let [<Literal>] InformationalVersion = "2.0.14"
12+
let [<Literal>] Version = "2.0.17"
13+
let [<Literal>] InformationalVersion = "2.0.17"

src/FSharp.Control.AsyncSeq/AssemblyInfo.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ open System.Reflection
44
[<assembly: AssemblyTitleAttribute("FSharp.Control.AsyncSeq")>]
55
[<assembly: AssemblyProductAttribute("FSharp.Control.AsyncSeq")>]
66
[<assembly: AssemblyDescriptionAttribute("Asynchronous sequences for F#")>]
7-
[<assembly: AssemblyVersionAttribute("2.0.14")>]
8-
[<assembly: AssemblyFileVersionAttribute("2.0.14")>]
7+
[<assembly: AssemblyVersionAttribute("2.0.17")>]
8+
[<assembly: AssemblyFileVersionAttribute("2.0.17")>]
99
do ()
1010

1111
module internal AssemblyVersionInformation =
12-
let [<Literal>] Version = "2.0.14"
13-
let [<Literal>] InformationalVersion = "2.0.14"
12+
let [<Literal>] Version = "2.0.17"
13+
let [<Literal>] InformationalVersion = "2.0.17"

tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqPerf.fsx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,39 @@ let collect n =
118118
//run replicate
119119
//run bind
120120
//run bindUnfold
121-
run collect
121+
//run collect
122122

123+
let Y = Choice1Of2
124+
let S = Choice2Of2
125+
126+
let timeMs = 500
123127

128+
let inp0 = [ ]
129+
let exp0 = [ ]
130+
131+
let inp1 = [ Y 1 ; Y 2 ; S timeMs ; Y 3 ; Y 4 ; S timeMs ; Y 5 ; Y 6 ]
132+
let exp1 = [ [1;2] ; [3;4] ; [5;6] ]
133+
134+
// let inp2 : Choice<int, int> list = [ S 500 ]
135+
// let exp2 : int list list = [ [] ; [] ; [] ; [] ]
136+
137+
let toSeq (xs:Choice<int, int> list) = asyncSeq {
138+
for x in xs do
139+
match x with
140+
| Choice1Of2 v -> yield v
141+
| Choice2Of2 s -> do! Async.Sleep s }
142+
143+
for (inp,exp) in [ (inp0,exp0) ; (inp1,exp1) ] do
144+
145+
let actual =
146+
toSeq inp
147+
|> AsyncSeq.bufferByTime (timeMs - 5)
148+
|> AsyncSeq.map List.ofArray
149+
|> AsyncSeq.toList
150+
151+
printfn "actual=%A expected=%A" actual exp
152+
153+
//let ls = toSeq inp |> AsyncSeq.toList
154+
//let actualLs = actual |> List.concat
155+
156+

tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs

Lines changed: 82 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -448,27 +448,91 @@ let ``AsyncSeq.bufferByTimeAndCount empty``() =
448448

449449
[<Test>]
450450
let ``AsyncSeq.bufferByTime`` () =
451-
452-
let s = asyncSeq {
453-
yield 1
454-
yield 2
455-
do! Async.Sleep 100
456-
yield 3
457-
yield 4
458-
do! Async.Sleep 100
459-
yield 5
460-
yield 6
461-
}
462451

463-
let actual =
464-
s
465-
|> AsyncSeq.bufferByTime 100
466-
|> AsyncSeq.map (List.ofArray)
467-
|> AsyncSeq.toList
452+
let Y = Choice1Of2
453+
let S = Choice2Of2
468454

469-
let expected = [ [1;2] ; [3;4] ; [5;6] ]
455+
let timeMs = 500
470456

471-
Assert.True ((actual = expected))
457+
let inp0 = [ ]
458+
let exp0 = [ ]
459+
460+
let inp1 = [ Y 1 ; Y 2 ; S timeMs ; Y 3 ; Y 4 ; S timeMs ; Y 5 ; Y 6 ]
461+
let exp1 = [ [1;2] ; [3;4] ; [5;6] ]
462+
463+
// let inp2 : Choice<int, int> list = [ S 500 ]
464+
// let exp2 : int list list = [ [] ; [] ; [] ; [] ]
465+
466+
let toSeq (xs:Choice<int, int> list) = asyncSeq {
467+
for x in xs do
468+
match x with
469+
| Choice1Of2 v -> yield v
470+
| Choice2Of2 s -> do! Async.Sleep s }
471+
472+
for (inp,exp) in [ (inp0,exp0) ; (inp1,exp1) ] do
473+
474+
let actual =
475+
toSeq inp
476+
|> AsyncSeq.bufferByTime (timeMs - 5)
477+
|> AsyncSeq.map List.ofArray
478+
|> AsyncSeq.toList
479+
480+
//let ls = toSeq inp |> AsyncSeq.toList
481+
//let actualLs = actual |> List.concat
482+
483+
Assert.True ((actual = exp))
484+
485+
// WARNING: Too timing sensitive
486+
//let rec prependToAll (a:'a) (ls:'a list) : 'a list =
487+
// match ls with
488+
// | [] -> []
489+
// | hd::tl -> a::hd::prependToAll a tl
490+
//
491+
//let rec intersperse (a:'a) (ls:'a list) : 'a list =
492+
// match ls with
493+
// | [] -> []
494+
// | hd::tl -> hd::prependToAll a tl
495+
//
496+
//let intercalate (l:'a list) (xs:'a list list) : 'a list =
497+
// intersperse l xs |> List.concat
498+
//
499+
//let batch (size:int) (ls:'a list) : 'a list list =
500+
// let rec go batch ls =
501+
// match ls with
502+
// | [] -> [List.rev batch]
503+
// | _ when List.length batch = size -> (List.rev batch)::go [] ls
504+
// | hd::tl -> go (hd::batch) tl
505+
// go [] ls
506+
//
507+
//[<Test>]
508+
//let ``AsyncSeq.bufferByTime2`` () =
509+
//
510+
// let Y = Choice1Of2
511+
// let S = Choice2Of2
512+
// let sleepMs = 100
513+
//
514+
// let toSeq (xs:Choice<int, int> list) = asyncSeq {
515+
// for x in xs do
516+
// match x with
517+
// | Choice1Of2 v -> yield v
518+
// | Choice2Of2 s -> do! Async.Sleep s }
519+
//
520+
// for (size,batchSize) in [ (0,0) ; (10,2) ; (100,2) ] do
521+
//
522+
// let expected =
523+
// List.init size id
524+
// |> batch batchSize
525+
//
526+
// let actual =
527+
// expected
528+
// |> List.map (List.map Y)
529+
// |> intercalate [S sleepMs]
530+
// |> toSeq
531+
// |> AsyncSeq.bufferByTime sleepMs
532+
// |> AsyncSeq.map List.ofArray
533+
// |> AsyncSeq.toList
534+
//
535+
// Assert.True ((actual = expected))
472536

473537
[<Test>]
474538
let ``AsyncSeq.bufferByCountAndTime should not block`` () =

0 commit comments

Comments
 (0)