-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into rename-stream-method
- Loading branch information
Showing
13 changed files
with
311 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
32 changes: 32 additions & 0 deletions
32
kyo-bench/src/main/scala/kyo/bench/arena/StreamIOBench.scala
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package kyo.bench.arena | ||
|
||
class StreamIOBench extends ArenaBench.SyncAndFork(25000000): | ||
val seq = (0 until 10000).toVector | ||
|
||
def catsBench() = | ||
import cats.effect.* | ||
import fs2.* | ||
Stream.emits(seq) | ||
.evalFilter(v => IO(v % 2 == 0)) | ||
.evalMap(v => IO(v + 1)) | ||
.compile | ||
.fold(0)(_ + _) | ||
end catsBench | ||
|
||
def kyoBench() = | ||
import kyo.* | ||
Stream.init(seq) | ||
.filter(v => IO(v % 2 == 0)) | ||
.map(v => IO(v + 1)) | ||
.runFold(0)(_ + _) | ||
end kyoBench | ||
|
||
def zioBench() = | ||
import zio.* | ||
import zio.stream.* | ||
ZStream.fromIterable(seq) | ||
.filterZIO(v => ZIO.succeed(v % 2 == 0)) | ||
.mapZIO(v => ZIO.succeed(v + 1)) | ||
.runSum | ||
end zioBench | ||
end StreamIOBench |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.