Skip to content
Merged
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
47 changes: 47 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// .scalafix.conf
rules = [
RemoveUnused
SortImports
ExplicitResultTypes
// fix.scala213.NullaryOverride
]
//NullaryOverride.mode = Rewrite
ExplicitResultTypes {
memberVisibility = [] # only rewrite implicit members
skipSimpleDefinitions = []
}
ExplicitImplicitTypes.symbolReplacements {
"scala/concurrent/ExecutionContextExecutor#" = "scala/concurrent/ExecutionContext#"
}
RemoveUnused.imports = true
RemoveUnused.privates = false
RemoveUnused.locals = false

//ignored files
// usually due them being used in our documentation - docs module is ignored anyway
// but some tests in other modules are also used used in the paradox build
ignored-files = [
"CustomMediaTypesSpec.scala"
]

//ignored packages
ignored-packages = [
"docs",
"doc",
"jdoc"
]

//sort imports, see https://github.com/NeQuissimus/sort-imports
SortImports.asciiSort = false
SortImports.blocks = [
"re:javax?\\.",
"scala.",
"*",
"com.sun."
"re:^(org\\.apache\\.pekko|pekko\\.)\\w*"
"org.reactivestreams."
"io.netty."
"org.scalatest."
"org.slf4j."
"com.typesafe."
]
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo

addCommandAlias("verifyCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck; +headerCheckAll; javafmtCheckAll")
addCommandAlias("applyCodeStyle", "+headerCreateAll; scalafmtAll; scalafmtSbt; javafmtAll")
addCommandAlias(name = "sortImports", value = ";scalafixEnable; scalafixAll SortImports; scalafmtAll")

inThisBuild(Def.settings(
apiURL := {
Expand Down Expand Up @@ -364,7 +365,7 @@ lazy val httpScalafixTests =

lazy val docs = project("docs")
.enablePlugins(ParadoxPlugin, PekkoParadoxPlugin, NoPublish)
.disablePlugins(MimaPlugin)
.disablePlugins(MimaPlugin, ScalafixPlugin)
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-actor-typed", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-multi-node-testkit", "provided", PekkoCoreDependency.default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,23 @@ package org.apache.pekko.http.cors

import java.util.concurrent.TimeUnit

import scala.concurrent.{ Await, ExecutionContext }
import scala.concurrent.duration._

import org.openjdk.jmh.annotations._

import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.http.cors.scaladsl.CorsDirectives
import pekko.http.cors.scaladsl.settings.CorsSettings
import pekko.http.scaladsl.Http
import pekko.http.scaladsl.Http.ServerBinding
import pekko.http.scaladsl.model.headers.{ `Access-Control-Request-Method`, Origin }
import pekko.http.scaladsl.model.{ HttpMethods, HttpRequest }
import pekko.http.scaladsl.model.headers.{ `Access-Control-Request-Method`, Origin }
import pekko.http.scaladsl.server.Directives
import pekko.http.scaladsl.unmarshalling.Unmarshal
import pekko.http.cors.scaladsl.CorsDirectives
import pekko.http.cors.scaladsl.settings.CorsSettings
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._

import scala.concurrent.duration._
import scala.concurrent.{ Await, ExecutionContext }
import com.typesafe.config.ConfigFactory

@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.SECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ package org.apache.pekko.http.impl.engine
import java.net.InetSocketAddress
import java.util.concurrent.CountDownLatch

import scala.concurrent.{ ExecutionContext, Future }
import scala.util.{ Failure, Success }

import org.openjdk.jmh.annotations._

import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.http.CommonBenchmark
import pekko.http.impl.util.enhanceString_
import pekko.http.scaladsl.{ ClientTransport, Http }
import pekko.http.scaladsl.model.HttpRequest
import pekko.http.scaladsl.settings.{ ClientConnectionSettings, ConnectionPoolSettings }
import pekko.http.scaladsl.{ ClientTransport, Http }
import pekko.stream.scaladsl.Flow
import pekko.util.ByteString
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._

import scala.concurrent.{ ExecutionContext, Future }
import scala.util.{ Failure, Success }
import com.typesafe.config.ConfigFactory

/**
* A benchmark that tries to stress the pool and the client infrastructure (but nothing else)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ package org.apache.pekko.http.impl.engine

import java.util.concurrent.TimeUnit

import scala.concurrent.Await
import scala.concurrent.duration._

import org.openjdk.jmh.annotations._

import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.http.impl.engine.parsing.HttpHeaderParser
import pekko.http.impl.settings.ParserSettingsImpl
import pekko.http.scaladsl.model.MediaType
import pekko.util.ByteString
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._

import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory

@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ package org.apache.pekko.http.impl.engine

import java.util.concurrent.CountDownLatch

import scala.concurrent.ExecutionContext

import org.openjdk.jmh.annotations.{ Benchmark, Param, Setup, TearDown }

import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.http.CommonBenchmark
import pekko.http.scaladsl.model.{ ContentTypes, HttpEntity }
import pekko.stream.scaladsl.Source
import pekko.util.ByteString
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations.{ Benchmark, Param, Setup, TearDown }

import scala.concurrent.ExecutionContext
import com.typesafe.config.ConfigFactory

class HttpEntityBenchmark extends CommonBenchmark {
@Param(Array("strict", "default"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@

package org.apache.pekko.http.impl.engine

import com.typesafe.config.ConfigFactory
import java.util.concurrent.TimeUnit

import scala.concurrent.Await
import scala.concurrent.duration.{ Duration, DurationInt }

import org.apache.pekko
import pekko.{ BenchTestSourceSameElement, NotUsed }
import pekko.actor.ActorSystem
import pekko.http.impl.engine.ws.FrameEvent
import pekko.http.impl.engine.ws.Protocol.Opcode
import pekko.stream.scaladsl.{ Flow, Keep, Sink, Source }
import pekko.util.ByteString
import org.openjdk.jmh.annotations.{
Benchmark,
BenchmarkMode,
Expand All @@ -37,9 +33,15 @@ import org.openjdk.jmh.annotations.{
TearDown
}

import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration.{ Duration, DurationInt }
import org.apache.pekko
import pekko.{ BenchTestSourceSameElement, NotUsed }
import pekko.actor.ActorSystem
import pekko.http.impl.engine.ws.FrameEvent
import pekko.http.impl.engine.ws.Protocol.Opcode
import pekko.stream.scaladsl.{ Flow, Keep, Sink, Source }
import pekko.util.ByteString

import com.typesafe.config.ConfigFactory

object MessageToFrameRendererBenchmark {
final val OperationsPerInvocation = 100000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
package org.apache.pekko.http.impl.engine

import java.util.concurrent.CountDownLatch

import org.openjdk.jmh.annotations._

import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.event.NoLogging
Expand All @@ -27,8 +30,8 @@ import pekko.stream.scaladsl.Flow
import pekko.stream.scaladsl.Source
import pekko.stream.scaladsl.TLSPlacebo
import pekko.util.ByteString

import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._

class ServerProcessingBenchmark extends CommonBenchmark {
val request = ByteString("GET / HTTP/1.1\r\nHost: localhost\r\nUser-Agent: test\r\n\r\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ package org.apache.pekko.http.impl.engine

import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit

import org.openjdk.jmh.annotations._

import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.event.NoLogging
Expand All @@ -32,8 +35,8 @@ import pekko.stream.scaladsl.Sink
import pekko.stream.scaladsl.Source
import pekko.stream.scaladsl.TLSPlacebo
import pekko.util.ByteString

import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._

@Warmup(iterations = 5, time = 2, timeUnit = TimeUnit.SECONDS)
class StreamServerProcessingBenchmark extends CommonBenchmark {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@

package org.apache.pekko.http.impl.engine.http2

import java.util.concurrent.{ CountDownLatch, TimeUnit }

import scala.concurrent.{ Await, ExecutionContext, Future }
import scala.concurrent.duration._

import org.openjdk.jmh.annotations._

import org.apache.pekko
import pekko.NotUsed
import pekko.actor.ActorSystem
Expand All @@ -24,12 +31,8 @@ import pekko.http.scaladsl.settings.{ ClientConnectionSettings, ServerSettings }
import pekko.stream.TLSProtocol.{ SslTlsInbound, SslTlsOutbound }
import pekko.stream.scaladsl.{ BidiFlow, Flow, Keep, Sink, Source }
import pekko.util.ByteString
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._

import java.util.concurrent.{ CountDownLatch, TimeUnit }
import scala.concurrent.duration._
import scala.concurrent.{ Await, ExecutionContext, Future }
import com.typesafe.config.ConfigFactory

/**
* Test converting a HttpRequest to bytes at the client and back to a request at the server, and vice-versa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@

package org.apache.pekko.http.impl.engine.http2

import org.openjdk.jmh.annotations.Param

import org.apache.pekko
import pekko.http.impl.engine.http2.FrameEvent.{ DataFrame, HeadersFrame }
import pekko.http.impl.engine.http2.framing.FrameRenderer
import pekko.http.scaladsl.model.HttpEntity.{ Chunk, LastChunk }
import pekko.http.scaladsl.model.{
AttributeKeys,
ContentTypes,
Expand All @@ -26,11 +27,12 @@ import pekko.http.scaladsl.model.{
HttpResponse,
Trailer
}
import pekko.http.scaladsl.model.HttpEntity.{ Chunk, LastChunk }
import pekko.http.scaladsl.model.headers.RawHeader
import pekko.stream.scaladsl.Source
import pekko.util.ByteString

import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations.Param

trait H2RequestResponseBenchmark extends HPackEncodingSupport {
@Param(Array("1"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@

package org.apache.pekko.http.impl.engine.http2

import java.util.concurrent.{ CountDownLatch, TimeUnit }

import scala.concurrent.{ Await, ExecutionContext, Future }
import scala.concurrent.duration._

import org.openjdk.jmh.annotations._

import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.http.CommonBenchmark
Expand All @@ -22,11 +29,6 @@ import pekko.http.scaladsl.settings.ServerSettings
import pekko.stream.TLSProtocol.{ SslTlsInbound, SslTlsOutbound }
import pekko.stream.scaladsl.{ Flow, Keep, Sink, Source }
import pekko.util.ByteString
import org.openjdk.jmh.annotations._

import java.util.concurrent.{ CountDownLatch, TimeUnit }
import scala.concurrent.duration._
import scala.concurrent.{ Await, ExecutionContext, Future }

class H2ServerProcessingBenchmark extends CommonBenchmark with H2RequestResponseBenchmark {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package org.apache.pekko.http.impl.engine.ws
import org.openjdk.jmh.annotations.Benchmark

import org.apache.pekko
import pekko.util.ByteString
import pekko.http.CommonBenchmark
import pekko.util.ByteString

class MaskingBench extends CommonBenchmark {
val data = ByteString(new Array[Byte](10000))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ package org.apache.pekko.http.impl.model.parser

import java.util.concurrent.TimeUnit

import org.apache.pekko
import pekko.http.scaladsl.model.Uri
import org.parboiled2.UTF8
import org.openjdk.jmh.annotations._
import org.openjdk.jmh.infra.Blackhole
import org.parboiled2.UTF8

import org.apache.pekko
import pekko.http.scaladsl.model.Uri

@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ package org.apache.pekko.http.scaladsl.unmarshalling.sse
import java.nio.file.{ Files, Path }
import java.util.concurrent.TimeUnit

import scala.concurrent.{ Await, Future }
import scala.concurrent.duration._

import org.openjdk.jmh.annotations._
import org.openjdk.jmh.infra.Blackhole

import org.apache.pekko
import pekko.Done
import pekko.actor.ActorSystem
import pekko.stream.scaladsl.{ FileIO, Keep, RunnableGraph, Sink, Source }
import pekko.util.ByteString
import org.openjdk.jmh.annotations._
import org.openjdk.jmh.infra.Blackhole

import scala.concurrent.{ Await, Future }
import scala.concurrent.duration._

@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
Expand Down
Loading
Loading