-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package kyo.bench | ||
|
||
class LoggingBench extends Bench.SyncAndFork[Unit] { | ||
|
||
val depth = 10000 | ||
|
||
def kyoBench() = { | ||
import kyo._ | ||
import kyo.ios._ | ||
import kyo.logs._ | ||
def loop(i: Int): Unit > IOs = | ||
if (i > depth) | ||
() | ||
else | ||
Logs.error("test").flatMap { _ => | ||
loop(i + 1) | ||
} | ||
loop(0) | ||
} | ||
|
||
def catsBench() = { | ||
import cats.effect._ | ||
import org.typelevel.log4cats.slf4j.Slf4jLogger | ||
import cats.effect.unsafe.implicits.global | ||
|
||
val logger = Slf4jLogger.create[IO].unsafeRunSync() | ||
|
||
def loop(i: Int): IO[Unit] = | ||
if (i > depth) | ||
IO.unit | ||
else | ||
logger.error("test").flatMap { _ => | ||
loop(i + 1) | ||
} | ||
loop(0) | ||
} | ||
|
||
def zioBench() = { | ||
import zio._ | ||
import zio.logging.backend.SLF4J | ||
|
||
def loop(i: Int): UIO[Unit] = | ||
if (i > depth) | ||
ZIO.unit | ||
else | ||
ZIO.logError("test").flatMap { _ => | ||
loop(i + 1) | ||
} | ||
loop(0).provide(Runtime.removeDefaultLoggers) | ||
} | ||
} |