Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,28 @@ class ObservableMapAccumulateBenchmark {
.runSyncUnsafe()
}

@Benchmark
def fs2Stream() = {
FS2Stream
.emits(0 until n)
.mapAccumulate(0) { case (acc, i) =>
val added = acc + i
(added, added)
}
.compile
.drain
}
// @Benchmark
// def fs2Stream() = {
// FS2Stream
// .emits(0 until n)
// .mapAccumulate(0) { case (acc, i) =>
// val added = acc + i
// (added, added)
// }
// .compile
// .drain
// }

@Benchmark
def zioStream() = {
val stream = ZStream
.fromIterable(0 until n)
.mapAccum(0) { case (acc, i) =>
val added = acc + i
(added, added)
}
.runDrain

zioUntracedRuntime.unsafeRun(stream)
}
// @Benchmark
// def zioStream() = {
// val stream = ZStream
// .fromIterable(0 until n)
// .mapAccum(0) { case (acc, i) =>
// val added = acc + i
// (added, added)
// }
// .runDrain
//
// zioUntracedRuntime.unsafeRun(stream)
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

/*
package monix.benchmarks

import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -49,7 +48,7 @@ import scala.concurrent.{Await, Promise}
@OutputTimeUnit(TimeUnit.SECONDS)
class ObservableMapTaskBenchmark {
@Param(Array("10000"))
var size: Int = _
var size: Long = _

@Benchmark
def run(): Long = {
Expand Down Expand Up @@ -77,4 +76,3 @@ class ObservableMapTaskBenchmark {
Await.result(p.future, Duration.Inf)
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

/*
package monix.benchmarks

import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -51,7 +50,7 @@ class TaskAttemptBenchmark {
if (i < size) Task.pure(i + 1).attempt.flatMap(_.fold(Task.raiseError, loop))
else Task.pure(i)

Await.result(loop(0).runAsync, Duration.Inf)
Await.result(loop(0).runToFuture, Duration.Inf)
}

@Benchmark
Expand All @@ -68,7 +67,6 @@ class TaskAttemptBenchmark {
else
Task.pure(i)

Await.result(loop(0).runAsync, Duration.Inf)
Await.result(loop(0).runToFuture, Duration.Inf)
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

/*
package monix.benchmarks

import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -53,7 +52,7 @@ class TaskDeepBindBenchmark {
_ <- if(j > size) Task.pure(j) else loop(j + 1)
} yield j

Await.result(loop(0).runAsync, Duration.Inf)
Await.result(loop(0).runToFuture, Duration.Inf)
}

@Benchmark
Expand All @@ -64,7 +63,7 @@ class TaskDeepBindBenchmark {
_ <- if(j > size) Task.eval(j) else loop(j + 1)
} yield j

Await.result(loop(0).runAsync, Duration.Inf)
Await.result(loop(0).runToFuture, Duration.Inf)
}

@Benchmark
Expand All @@ -75,7 +74,6 @@ class TaskDeepBindBenchmark {
_ <- if(j > size) Task.eval(j) else loop(j + 1)
} yield j

Await.result(loop(0).runAsync, Duration.Inf)
Await.result(loop(0).runToFuture, Duration.Inf)
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

/*
package monix.benchmarks

import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -55,7 +54,7 @@ class TaskHandleErrorBenchmark {
else
Task.pure(i)

Await.result(loop(0).runAsync, Duration.Inf)
Await.result(loop(0).runToFuture, Duration.Inf)
}

@Benchmark
Expand All @@ -71,7 +70,6 @@ class TaskHandleErrorBenchmark {
else
Task.pure(i)

Await.result(loop(0).runAsync, Duration.Inf)
Await.result(loop(0).runToFuture, Duration.Inf)
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

/*
package monix.benchmarks

import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -71,4 +70,3 @@ object TaskMapCallsBenchmark {
sum
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

/*
package monix.benchmarks

import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -64,7 +63,7 @@ object TaskMapStreamBenchmark {
stream = mapStream(addOne)(stream)
i += 1
}
Await.result(sum(0)(stream).runAsync, Duration.Inf)
Await.result(sum(0)(stream).runToFuture, Duration.Inf)
}

final case class Stream(value: Int, next: Task[Option[Stream]])
Expand Down Expand Up @@ -92,4 +91,3 @@ object TaskMapStreamBenchmark {
Task.pure(acc)
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,26 @@ class TaskSequenceBenchmark {

val parallelism: Int = 10

@Benchmark
def catsSequence(): Long = {
val tasks = (0 until count).map(_ => IO(1)).toList
val result = tasks.sequence.map(_.sum.toLong)
result.unsafeRunSync()
}

@Benchmark
def catsParSequence(): Long = {
val tasks = (0 until count).map(_ => IO(1)).toList
val result = tasks.parSequence.map(_.sum.toLong)
result.unsafeRunSync()
}

@Benchmark
def catsParSequenceN(): Long = {
val tasks = (0 until count).map(_ => IO(1)).toList
val result = tasks.parSequenceN(parallelism.toLong).map(_.sum.toLong)
result.unsafeRunSync()
}
// @Benchmark
// def catsSequence(): Long = {
// val tasks = (0 until count).map(_ => IO(1)).toList
// val result = tasks.sequence.map(_.sum.toLong)
// result.unsafeRunSync()
// }

// @Benchmark
// def catsParSequence(): Long = {
// val tasks = (0 until count).map(_ => IO(1)).toList
// val result = tasks.parSequence.map(_.sum.toLong)
// result.unsafeRunSync()
// }

// @Benchmark
// def catsParSequenceN(): Long = {
// val tasks = (0 until count).map(_ => IO(1)).toList
// val result = tasks.parSequenceN(parallelism.toLong).map(_.sum.toLong)
// result.unsafeRunSync()
// }

@Benchmark
def monixSequence(): Long = {
Expand Down Expand Up @@ -115,32 +115,32 @@ class TaskSequenceBenchmark {
result.runSyncUnsafe()
}

@Benchmark
def zioSequence(): Long = {
val tasks = (0 until count).map(_ => ZIO.effectTotal(1)).toList
val result = ZIO.collectAll(tasks).map(_.sum.toLong)
zioUntracedRuntime.unsafeRun(result)
}

@Benchmark
def zioParSequence(): Long = {
val tasks = (0 until count).map(_ => ZIO.effectTotal(1)).toList
val result = ZIO.collectAllPar(tasks).map(_.sum.toLong)
zioUntracedRuntime.unsafeRun(result)
}

@Benchmark
def zioParSequenceN(): Long = {
val tasks = (0 until count).map(_ => ZIO.effectTotal(1)).toList
val result = ZIO.collectAllParN(parallelism)(tasks).map(_.sum.toLong)
zioUntracedRuntime.unsafeRun(result)
}

@Benchmark
def futureSequence(): Long = {
val futures = (0 until count).map(_ => Future(1)).toList
val f: Future[Long] = Future.sequence(futures).map(_.sum.toLong)
Await.result(f, Duration.Inf)
}

}
// @Benchmark
// def zioSequence(): Long = {
// val tasks = (0 until count).map(_ => ZIO.effectTotal(1)).toList
// val result = ZIO.collectAll(tasks).map(_.sum.toLong)
// zioUntracedRuntime.unsafeRun(result)
// }

// @Benchmark
// def zioParSequence(): Long = {
// val tasks = (0 until count).map(_ => ZIO.effectTotal(1)).toList
// val result = ZIO.collectAllPar(tasks).map(_.sum.toLong)
// zioUntracedRuntime.unsafeRun(result)
// }

// @Benchmark
// def zioParSequenceN(): Long = {
// val tasks = (0 until count).map(_ => ZIO.effectTotal(1)).toList
// val result = ZIO.collectAllParN(parallelism)(tasks).map(_.sum.toLong)
// zioUntracedRuntime.unsafeRun(result)
// }

// @Benchmark
// def futureSequence(): Long = {
// val futures = (0 until count).map(_ => Future(1)).toList
// val f: Future[Long] = Future.sequence(futures).map(_.sum.toLong)
// Await.result(f, Duration.Inf)
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

/*
package monix.benchmarks

import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -79,4 +78,3 @@ class TaskShallowBindBenchmark {
Await.result(task.runToFuture, Duration.Inf)
}
}
*/
Loading