[fleet] a bit of performance in tcp socket

- kotlinx.serialization on hot path costs 10_000 m/s
- unconfined ServerRequestDispatcher give 3_000 more

GitOrigin-RevId: 7d64ebd2d5603015283b19db74fe4c5835e95f96
This commit is contained in:
Alexander Shparun
2025-08-05 04:55:50 +00:00
committed by intellij-monorepo-bot
parent ea4c14fcaf
commit 2eb3e69abb
2 changed files with 2 additions and 2 deletions
@@ -59,7 +59,7 @@ class ServerRequestDispatcher(private val connectionListener: ConnectionListener
broadcastSafely(TransportMessage.RouteOpened(route))
connectionListener?.onConnect(endpoint, route, socketId, presentableName)
coroutineScope {
val connectionJob = launch {
val connectionJob = launch(Dispatchers.Unconfined) {
receive.consumeEach { message ->
when (message) {
is TransportMessage.Envelope -> {
@@ -21,7 +21,7 @@ sealed class TransportMessage {
@Serializable
@SerialName("envelope")
data class Envelope(val destination: UID, val origin: UID, val otelData: String? = null, val payload: String) : TransportMessage()
data class Envelope(val destination: UID, val origin: UID, val otelData: String? = null, val payload: String) : TransportMessage()
fun serialize(): String {
return Json.encodeToString(serializer, this)