Skip to content

Commit

Permalink
remove ox benchs for now
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Sep 8, 2023
1 parent d2e9885 commit 50837c3
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 65 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ lazy val `kyo-bench` =
`without-cross-scala`,
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.1",
libraryDependencies += "dev.zio" %% "zio" % zioVersion,
libraryDependencies += "dev.zio" %% "zio-concurrent" % zioVersion,
libraryDependencies += "com.softwaremill.ox" %% "core" % "0.0.12"
libraryDependencies += "dev.zio" %% "zio-concurrent" % zioVersion
// libraryDependencies += "com.softwaremill.ox" %% "core" % "0.0.12"
)

lazy val `js-settings` = Seq(
Expand Down
24 changes: 12 additions & 12 deletions kyo-bench/src/main/scala/kyo/bench/BroadFlatMapBench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ class BroadFlatMapBench extends Bench.SyncAndFork[BigInt] {
zioFib(depth)
}

def oxFib(n: Int): BigInt =
if (n <= 1) n
else oxFib(n - 1) + oxFib(n - 2)
// def oxFib(n: Int): BigInt =
// if (n <= 1) n
// else oxFib(n - 1) + oxFib(n - 2)

// @Benchmark
def syncOx(): BigInt = {
oxFib(depth)
}
// def syncOx(): BigInt = {
// oxFib(depth)
// }

// @Benchmark
def forkOx(): BigInt = {
import ox._
scoped {
fork(oxFib(depth)).join()
}
}
// def forkOx(): BigInt = {
// import ox._
// scoped {
// fork(oxFib(depth)).join()
// }
// }
}
30 changes: 15 additions & 15 deletions kyo-bench/src/main/scala/kyo/bench/ChainedForkBench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ class ChainedForkBench extends Bench.ForkOnly[Int] {
}

// @Benchmark
def forkOx() = {
import ox._
def iterate(p: CompletableFuture[Unit], n: Int): Unit =
if (n <= 0) p.complete(())
else
scoped {
fork(iterate(p, n - 1))
}

scoped {
val p = new CompletableFuture[Unit]()
fork(iterate(p, depth))
p.get()
}
}
// def forkOx() = {
// import ox._
// def iterate(p: CompletableFuture[Unit], n: Int): Unit =
// if (n <= 0) p.complete(())
// else
// scoped {
// fork(iterate(p, n - 1))
// }

// scoped {
// val p = new CompletableFuture[Unit]()
// fork(iterate(p, depth))
// p.get()
// }
// }
}
36 changes: 18 additions & 18 deletions kyo-bench/src/main/scala/kyo/bench/ForkManyBench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,22 @@ class ForkManyBench extends Bench.ForkOnly[Int] {
}

// @Benchmark
def forkOx() = {
import ox._
import ox.channels._

scoped {
val promise = new CompletableFuture[Unit]
val ref = new AtomicInteger(depth)
for (_ <- 0 until depth) {
fork {
ref.decrementAndGet() match {
case 1 => promise.complete(())
case _ => ()
}
}
}
promise.get()
}
}
// def forkOx() = {
// import ox._
// import ox.channels._

// scoped {
// val promise = new CompletableFuture[Unit]
// val ref = new AtomicInteger(depth)
// for (_ <- 0 until depth) {
// fork {
// ref.decrementAndGet() match {
// case 1 => promise.complete(())
// case _ => ()
// }
// }
// }
// promise.get()
// }
// }
}
36 changes: 18 additions & 18 deletions kyo-bench/src/main/scala/kyo/bench/ProducerConsumerBench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ class ProducerConsumerBench extends Bench.ForkOnly[Unit] {
}

// @Benchmark
def forkOx() = {
import ox._
import ox.channels._

val q = Channel[Unit](depth / 2)
scoped {
val f1 =
fork {
for (_ <- 0 until depth) q.send(()).orThrow
}
val f2 =
fork {
for (_ <- 0 until depth) q.take(1).drain()
}
f1.join()
f2.join()
}
}
// def forkOx() = {
// import ox._
// import ox.channels._

// val q = Channel[Unit](depth / 2)
// scoped {
// val f1 =
// fork {
// for (_ <- 0 until depth) q.send(()).orThrow
// }
// val f2 =
// fork {
// for (_ <- 0 until depth) q.take(1).drain()
// }
// f1.join()
// f2.join()
// }
// }
}

0 comments on commit 50837c3

Please sign in to comment.