Skip to content

Instantly share code, notes, and snippets.

@kamilkloch
kamilkloch / gist:058a8ce8f59e5ecee71085670b49577d
Created July 12, 2023 11:58
HDRHistogram latency - Blaze
0.000 0.000000000000 1199614 1.00
0.000 0.100000000000 1199614 1.11
0.000 0.200000000000 1199614 1.25
0.000 0.300000000000 1199614 1.43
0.000 0.400000000000 1199614 1.67
0.000 0.500000000000 1199614 2.00
0.000 0.550000000000 1199614 2.22
0.000 0.600000000000 1199614 2.50
0.000 0.650000000000 1199614 2.86
0.000 0.700000000000 1199614 3.33
@kamilkloch
kamilkloch / gist:59beca49f1a478c9a533544446e2d480
Created July 12, 2023 12:00
HDRHistogram latency - ember
2.000 0.000000000000 674780 1.00
2.000 0.100000000000 674780 1.11
2.000 0.200000000000 674780 1.25
2.000 0.300000000000 674780 1.43
2.000 0.400000000000 674780 1.67
2.000 0.500000000000 674780 2.00
2.000 0.550000000000 674780 2.22
3.000 0.600000000000 1148916 2.50
3.000 0.650000000000 1148916 2.86
3.000 0.700000000000 1148916 3.33
@kamilkloch
kamilkloch / gist:7dd03b4007043a9a2170d53189930f35
Created July 13, 2023 08:39
HDRHistogram latency - zio-http
0.000 0.000000000000 1199930 1.00
0.000 0.100000000000 1199930 1.11
0.000 0.200000000000 1199930 1.25
0.000 0.300000000000 1199930 1.43
0.000 0.400000000000 1199930 1.67
0.000 0.500000000000 1199930 2.00
0.000 0.550000000000 1199930 2.22
0.000 0.600000000000 1199930 2.50
0.000 0.650000000000 1199930 2.86
0.000 0.700000000000 1199930 3.33
@kamilkloch
kamilkloch / gist:54da5d5f55798b68d5b093f867ab710c
Created July 13, 2023 09:06
HDRHistogram latency - ember, CE 3.6, fs2 3.8
0.000 0.000000000000 1149923 1.00
0.000 0.100000000000 1149923 1.11
0.000 0.200000000000 1149923 1.25
0.000 0.300000000000 1149923 1.43
0.000 0.400000000000 1149923 1.67
0.000 0.500000000000 1149923 2.00
0.000 0.550000000000 1149923 2.22
0.000 0.600000000000 1149923 2.50
0.000 0.650000000000 1149923 2.86
0.000 0.700000000000 1149923 3.33
import cats.effect._
import fs2._
import org.http4s._
import org.http4s.blaze.server.BlazeServerBuilder
import org.http4s.dsl.Http4sDsl
import org.http4s.implicits._
import org.http4s.server.websocket.WebSocketBuilder2
import org.http4s.websocket.WebSocketFrame
import scala.concurrent.duration._
Value Percentile TotalCount 1/(1-Percentile)
0.000 0.000000000000 1189750 1.00
0.000 0.100000000000 1189750 1.11
0.000 0.200000000000 1189750 1.25
0.000 0.300000000000 1189750 1.43
0.000 0.400000000000 1189750 1.67
0.000 0.500000000000 1189750 2.00
0.000 0.550000000000 1189750 2.22
0.000 0.600000000000 1189750 2.50
import cats.effect.std.Supervisor
import cats.effect.{IO, IOApp}
import fs2.Stream
import fs2.concurrent.Topic
import cats.syntax.all._
import scala.concurrent.duration.DurationInt
object Topics extends IOApp.Simple {
import zio.Clock.ClockLive
import zio.Console.ConsoleLive
import zio._
import zio.stream.ZStream
import java.io.IOException
import java.util.concurrent.TimeUnit
object ZioHub extends ZIOAppDefault {
override def run: ZIO[Any with ZIOAppArgs with Scope, Any, Any] = {
import cats.effect.std.Supervisor
import cats.effect.{IO, IOApp}
import cats.syntax.all._
import org.HdrHistogram.{ConcurrentHistogram, Histogram}
import scala.concurrent.duration.DurationInt
import scala.util.chaining.scalaUtilChainingOps
object RefProducer extends IOApp.Simple {
val n = 20_000
@kamilkloch
kamilkloch / DeferredAsyncPerf.scala
Created August 14, 2023 11:07
Benchmark IO.async vs manual Deferred
import cats.effect.std.Dispatcher
import cats.effect.{IO, IOApp}
import cats.syntax.all._
import java.util.concurrent.atomic.AtomicInteger
object DeferredAsyncPerf extends IOApp.Simple {
trait Model {
def addListener(onResponse: Either[Throwable, Int] => Unit): Unit