chore: sort imports (#2235)

This commit is contained in:
He-Pin(kerr) 2025-09-20 11:30:05 +08:00 committed by GitHub
parent 4d89553471
commit 870d4499cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1161 changed files with 3370 additions and 2786 deletions

View file

@ -19,9 +19,10 @@ import scala.concurrent.Await
import scala.concurrent.duration._
import BenchmarkActors._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import com.typesafe.config.ConfigFactory
object ActorBenchmark {
// Constants because they are used in annotations
final val threads = 8 // update according to cpu

View file

@ -15,13 +15,14 @@ package org.apache.pekko.actor
import java.util.concurrent.TimeUnit
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
import pekko.actor.BenchmarkActors._
import pekko.actor.ForkJoinActorBenchmark.cores
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.Throughput))
@Fork(1)

View file

@ -15,11 +15,12 @@ package org.apache.pekko.actor
import java.util.concurrent.TimeUnit
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko.actor.BenchmarkActors._
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.Throughput))
@Fork(1)

View file

@ -15,13 +15,14 @@ package org.apache.pekko.actor
import java.util.concurrent.{ CountDownLatch, TimeUnit }
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
import pekko.actor.BenchmarkActors._
import pekko.actor.ForkJoinActorBenchmark.cores
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.Throughput))
@Fork(1)

View file

@ -20,11 +20,12 @@ import scala.concurrent.Await
import scala.concurrent.duration._
import BenchmarkActors._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko.testkit.TestProbe
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.Throughput))
@Fork(1)

View file

@ -16,7 +16,6 @@ package org.apache.pekko.actor
import scala.annotation.tailrec
import scala.concurrent.duration.Duration
import com.typesafe.config.Config
import org.jctools.queues.MpscGrowableArrayQueue
import org.apache.pekko
@ -27,6 +26,8 @@ import pekko.dispatch.MailboxType
import pekko.dispatch.MessageQueue
import pekko.dispatch.ProducesMessageQueue
import com.typesafe.config.Config
case class JCToolsMailbox(val capacity: Int) extends MailboxType with ProducesMessageQueue[BoundedNodeMessageQueue] {
def this(settings: ActorSystem.Settings, config: Config) = this(config.getInt("mailbox-capacity"))

View file

@ -16,7 +16,6 @@ package org.apache.pekko.actor
import scala.annotation.tailrec
import scala.concurrent.duration.Duration
import com.typesafe.config.Config
import org.agrona.concurrent.ManyToOneConcurrentArrayQueue
import org.apache.pekko
@ -27,6 +26,8 @@ import pekko.dispatch.MailboxType
import pekko.dispatch.MessageQueue
import pekko.dispatch.ProducesMessageQueue
import com.typesafe.config.Config
/**
* ManyToOneArrayMailbox is a high-performance, multiple-producer single-consumer, bounded MailboxType,
* Noteworthy is that it discards overflow as DeadLetters.

View file

@ -18,11 +18,12 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko.testkit.TestProbe
import com.typesafe.config.ConfigFactory
object StashCreationBenchmark {
class StashingActor extends Actor with Stash {
def receive = {

View file

@ -18,7 +18,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.{ Config, ConfigFactory }
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -26,6 +25,8 @@ import pekko.dispatch._
import pekko.testkit.TestProbe
import pekko.util.Helpers.ConfigOps
import com.typesafe.config.{ Config, ConfigFactory }
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.SingleShotTime))
@Fork(5)

View file

@ -18,12 +18,13 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
import pekko.actor.typed.scaladsl.AskPattern._
import com.typesafe.config.ConfigFactory
object TypedActorBenchmark {
// Constants because they are used in annotations
final val threads = 8 // update according to cpu

View file

@ -19,7 +19,6 @@ import scala.concurrent.Await
import scala.concurrent.Future
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.BenchmarkMode
import org.openjdk.jmh.annotations.Fork
@ -38,6 +37,8 @@ import org.openjdk.jmh.annotations.Warmup
import org.apache.pekko
import pekko.actor.typed.scaladsl.AskPattern._
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.Throughput))
@Fork(1)

View file

@ -21,7 +21,6 @@ import scala.concurrent.duration._
import scala.util.Failure
import scala.util.Success
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -34,6 +33,8 @@ import pekko.actor.typed.receptionist.ServiceKey
import pekko.actor.typed.scaladsl.AskPattern._
import pekko.actor.typed.scaladsl.Behaviors
import com.typesafe.config.ConfigFactory
object Producer {
trait Command

View file

@ -18,7 +18,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations.{ Scope => JmhScope }
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.BenchmarkMode
@ -38,6 +37,8 @@ import pekko.cluster.Cluster
import pekko.serialization.SerializationExtension
import pekko.serialization.Serializers
import com.typesafe.config.ConfigFactory
@Fork(2)
@State(JmhScope.Benchmark)
@BenchmarkMode(Array(Mode.Throughput))

View file

@ -15,9 +15,10 @@ package org.apache.pekko.dispatch
import java.util.concurrent.TimeUnit
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.Throughput))
@Fork(2)

View file

@ -18,13 +18,14 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
import pekko.actor._
import pekko.testkit.TestProbe
import com.typesafe.config.ConfigFactory
object NodeQueueBenchmark {
final val burst = 100000
case object Stop

View file

@ -17,6 +17,9 @@
package org.apache.pekko.io.dns
import java.security.SecureRandom
import java.util.concurrent.{ ThreadLocalRandom, TimeUnit }
import org.openjdk.jmh.annotations.{
Benchmark,
BenchmarkMode,
@ -30,9 +33,6 @@ import org.openjdk.jmh.annotations.{
Warmup
}
import java.util.concurrent.{ ThreadLocalRandom, TimeUnit }
import java.security.SecureRandom
@BenchmarkMode(Array(Mode.Throughput))
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 3, time = 5, timeUnit = TimeUnit.SECONDS)

View file

@ -15,18 +15,20 @@ package org.apache.pekko.persistence
import java.io.File
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn
import scala.concurrent.Await
import scala.concurrent.duration._
import org.apache.commons.io.FileUtils
import org.openjdk.jmh.annotations._
import org.apache.pekko
import pekko.actor._
import pekko.persistence.journal.AsyncWriteTarget._
import pekko.persistence.journal.leveldb.{ SharedLeveldbJournal, SharedLeveldbStore }
import pekko.testkit.TestProbe
import scala.annotation.nowarn
/*
# OS: OSX 10.9.3
# CPU: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz

View file

@ -19,13 +19,12 @@ import java.nio.ByteOrder
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn
import scala.annotation.tailrec
import scala.concurrent.Await
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.annotation.nowarn
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -42,6 +41,8 @@ import pekko.stream.SystemMaterializer
import pekko.stream.scaladsl._
import pekko.util.OptionVal
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@BenchmarkMode(Array(Mode.Throughput))

View file

@ -20,7 +20,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.agrona.concurrent.ManyToOneConcurrentArrayQueue
import org.openjdk.jmh.annotations._
@ -31,6 +30,8 @@ import pekko.stream.OverflowStrategy
import pekko.stream.SystemMaterializer
import pekko.stream.scaladsl._
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@BenchmarkMode(Array(Mode.Throughput))

View file

@ -13,15 +13,9 @@
package org.apache.pekko.remote.artery.compress
import org.apache.pekko
import pekko.actor.Actor
import pekko.actor.ActorRef
import pekko.actor.ActorSystem
import pekko.actor.ExtendedActorSystem
import pekko.actor.Props
import pekko.pattern.PromiseActorRef
import pekko.remote.artery.SerializationFormatCache
import pekko.serialization.Serialization
import scala.annotation.nowarn
import scala.concurrent.Promise
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Fork
import org.openjdk.jmh.annotations.Level
@ -33,8 +27,15 @@ import org.openjdk.jmh.annotations.State
import org.openjdk.jmh.annotations.TearDown
import org.openjdk.jmh.infra.Blackhole
import scala.annotation.nowarn
import scala.concurrent.Promise
import org.apache.pekko
import pekko.actor.Actor
import pekko.actor.ActorRef
import pekko.actor.ActorSystem
import pekko.actor.ExtendedActorSystem
import pekko.actor.Props
import pekko.pattern.PromiseActorRef
import pekko.remote.artery.SerializationFormatCache
import pekko.serialization.Serialization
/**
* Actually more like specific benchmarks for the few concrete LRU cache usages

View file

@ -19,11 +19,10 @@ import java.time.LocalDateTime
import java.util
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.annotation.nowarn
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -32,6 +31,8 @@ import pekko.serialization.Serialization
import pekko.serialization.SerializationExtension
import pekko.serialization.SerializerWithStringManifest
import com.typesafe.config.ConfigFactory
object JacksonSerializationBench {
trait TestMessage

View file

@ -19,7 +19,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -34,6 +33,8 @@ import pekko.stream.scaladsl._
import pekko.stream.testkit.scaladsl.StreamTestKit
import pekko.util.Timeout
import com.typesafe.config.ConfigFactory
object AskBenchmark {
final val OperationsPerInvocation = 100000
}

View file

@ -13,9 +13,16 @@
package org.apache.pekko.stream
import com.typesafe.config.ConfigFactory
import org.apache.pekko
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn
import scala.concurrent._
import scala.concurrent.duration._
import scala.util.control.NonFatal
import org.openjdk.jmh.annotations._
import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.stream.ActorAttributes.SupervisionStrategy
import pekko.stream.Attributes.SourceLocation
@ -25,11 +32,7 @@ import pekko.stream.impl.fusing.Collect.NotApplied
import pekko.stream.scaladsl._
import pekko.stream.stage.{ GraphStage, GraphStageLogic, InHandler, OutHandler }
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn
import scala.concurrent._
import scala.concurrent.duration._
import scala.util.control.NonFatal
import com.typesafe.config.ConfigFactory
object CollectBenchmark {
final val OperationsPerInvocation = 10000000

View file

@ -19,7 +19,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.{ Await, Future }
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -31,6 +30,8 @@ import pekko.stream.impl.fusing.GraphStages
import pekko.stream.scaladsl._
import pekko.stream.testkit.scaladsl.StreamTestKit
import com.typesafe.config.ConfigFactory
object FlatMapConcatBenchmark {
final val OperationsPerInvocation = 100000
}

View file

@ -20,7 +20,6 @@ import scala.concurrent.Await
import scala.concurrent.duration._
import scala.util.Success
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -30,6 +29,8 @@ import pekko.remote.artery.BenchTestSource
import pekko.stream.impl.fusing.GraphStages
import pekko.stream.scaladsl._
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.SECONDS)
@BenchmarkMode(Array(Mode.Throughput))

View file

@ -20,8 +20,6 @@ import scala.concurrent.Await
import scala.concurrent.duration._
import scala.util.Random
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -33,6 +31,9 @@ import pekko.stream.scaladsl.Sink
import pekko.stream.scaladsl.Source
import pekko.util.ByteString
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.SECONDS)
@BenchmarkMode(Array(Mode.Throughput))

View file

@ -19,7 +19,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.openjdk.jmh.annotations.OperationsPerInvocation
@ -29,6 +28,8 @@ import pekko.actor.ActorSystem
import pekko.stream.scaladsl._
import pekko.stream.stage._
import com.typesafe.config.ConfigFactory
object FusedGraphsBenchmark {
val ElementCount = 100 * 1000

View file

@ -19,8 +19,8 @@ import org.openjdk.jmh.annotations._
import org.apache.pekko
import pekko.event._
import pekko.stream.impl.fusing.GraphInterpreterSpecKit
import pekko.stream.impl.fusing.GraphInterpreter.{ DownstreamBoundaryStageLogic, UpstreamBoundaryStageLogic }
import pekko.stream.impl.fusing.GraphInterpreterSpecKit
import pekko.stream.impl.fusing.GraphStages
import pekko.stream.stage._

View file

@ -22,7 +22,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent._
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -30,6 +29,8 @@ import pekko.NotUsed
import pekko.actor.ActorSystem
import pekko.stream.scaladsl._
import com.typesafe.config.ConfigFactory
object LazyFutureSourceBenchmark {
final val OperationsPerInvocation = 100000
}

View file

@ -20,7 +20,6 @@ import scala.concurrent.Await
import scala.concurrent.Future
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -31,6 +30,8 @@ import pekko.remote.artery.LatchSink
import pekko.stream.scaladsl._
import pekko.stream.testkit.scaladsl.StreamTestKit
import com.typesafe.config.ConfigFactory
object MapAsyncBenchmark {
final val OperationsPerInvocation = 100000
}

View file

@ -19,7 +19,6 @@ import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -32,6 +31,8 @@ import pekko.stream.scaladsl._
import pekko.stream.scaladsl.PartitionHub
import pekko.stream.testkit.scaladsl.StreamTestKit
import com.typesafe.config.ConfigFactory
object PartitionHubBenchmark {
final val OperationsPerInvocation = 100000
}

View file

@ -20,7 +20,6 @@ import scala.concurrent.Await
import scala.concurrent.duration._
import scala.util.Success
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
@ -28,6 +27,8 @@ import pekko.actor.ActorSystem
import pekko.remote.artery.BenchTestSource
import pekko.stream.scaladsl._
import com.typesafe.config.ConfigFactory
/*
Just a brief reference run (3.1 GHz Intel Core i7, MacBook Pro late 2017):
[info] SourceRefBenchmark.source_ref_100k_elements thrpt 10 724650.336 ± 233643.256 ops/s

View file

@ -19,18 +19,18 @@ package org.apache.pekko.stream
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn
import scala.collection.immutable
import scala.concurrent._
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import org.openjdk.jmh.annotations._
import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.stream.scaladsl._
import scala.annotation.nowarn
import com.typesafe.config.ConfigFactory
object ZipWithIndexBenchmark {
final val OperationsPerInvocation = 100000

View file

@ -17,10 +17,10 @@
package org.apache.pekko.util
import org.openjdk.jmh.annotations._
import java.util.concurrent.TimeUnit
import org.openjdk.jmh.annotations._
@State(Scope.Benchmark)
@Measurement(timeUnit = TimeUnit.MILLISECONDS)
class ArrayCopyOf_Benchmark {

View file

@ -13,6 +13,8 @@
package org.apache.pekko.util
import java.util.concurrent.TimeUnit
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Fork
import org.openjdk.jmh.annotations.Measurement
@ -21,8 +23,6 @@ import org.openjdk.jmh.annotations.Setup
import org.openjdk.jmh.annotations.State
import org.openjdk.jmh.annotations.Warmup
import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
@Fork(1)
@Warmup(iterations = 3, time = 20, timeUnit = TimeUnit.SECONDS)

View file

@ -13,6 +13,8 @@
package org.apache.pekko.util
import java.util.concurrent.TimeUnit
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Fork
import org.openjdk.jmh.annotations.Measurement
@ -21,8 +23,6 @@ import org.openjdk.jmh.annotations.Setup
import org.openjdk.jmh.annotations.State
import org.openjdk.jmh.annotations.Warmup
import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
@Fork(1)
@Warmup(iterations = 3, time = 20, timeUnit = TimeUnit.SECONDS)