From 9e69eaf1c7b0c4985d37f3f4595e2e2478d389f2 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 11 Jan 2022 14:12:30 +0100 Subject: perf(simulator): Move logger field out of class This change updates the FlowConsumerContextImpl by moving the logger outside of the class. This prevents each instance of this class from having to construct a logger instance. --- .../opendc/simulator/flow/internal/FlowConsumerContextImpl.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'opendc-simulator/opendc-simulator-flow') diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt index 58ca918b..1d39d61c 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt @@ -28,6 +28,11 @@ import java.util.* import kotlin.math.max import kotlin.math.min +/** + * The logging instance of this connection. + */ +private val logger = KotlinLogging.logger {} + /** * Implementation of a [FlowConnection] managing the communication between flow sources and consumers. */ @@ -36,11 +41,6 @@ internal class FlowConsumerContextImpl( private val source: FlowSource, private val logic: FlowConsumerLogic ) : FlowConsumerContext { - /** - * The logging instance of this connection. - */ - private val logger = KotlinLogging.logger {} - /** * The capacity of the connection. */ -- cgit v1.2.3