diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-10-08 22:02:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-08 22:02:07 +0200 |
| commit | b7a71e5b4aa77b41ef41deec2ace42b67a5a13a7 (patch) | |
| tree | b88bbede15108c6855d7f94ded4c7054df186a72 /opendc-simulator/opendc-simulator-compute/src/jmh | |
| parent | 3098eeb116a80ce12e6575e454d0448867478792 (diff) | |
| parent | e2f002358e9d5be2239fa2cb7ca92c9c96a21b6f (diff) | |
merge: Performance improvements for flow engine
This pull request applies multiple performance improvements for the flow engine and
compute simulator.
* Optimize SimTraceWorkload (by storing fragments using several arrays)
* Skip fair-share algorithm if capacity remaining
* Count interference for multiplexer inputs
* Simplify FlowSink implementation
* Do not update outputs if rate is unchanged
* Eliminate ArrayList iteration overhead
* Optimize clock storage
* Specialize FlowEngine queues
* Eliminate clock access in hot path
**Breaking API Changes**
* `SimTraceWorkload` now accepts a `SimTrace` as parameter. This trace can be constructed using fragments or directly using builder class. Internally, the trace is now stored using several arrays.
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute/src/jmh')
| -rw-r--r-- | opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt index b8e0227a..cb52d24f 100644 --- a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt +++ b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt @@ -22,7 +22,6 @@ package org.opendc.simulator.compute -import javafx.application.Application.launch import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch @@ -34,6 +33,7 @@ import org.opendc.simulator.compute.model.ProcessingNode import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.ConstantPowerModel import org.opendc.simulator.compute.power.SimplePowerDriver +import org.opendc.simulator.compute.workload.SimTrace import org.opendc.simulator.compute.workload.SimTraceWorkload import org.opendc.simulator.core.runBlockingSimulation import org.opendc.simulator.flow.FlowEngine @@ -48,7 +48,7 @@ import java.util.concurrent.TimeUnit @OptIn(ExperimentalCoroutinesApi::class) class SimMachineBenchmarks { private lateinit var machineModel: MachineModel - private lateinit var trace: Sequence<SimTraceWorkload.Fragment> + private lateinit var trace: SimTrace @Setup fun setUp() { @@ -60,8 +60,13 @@ class SimMachineBenchmarks { ) val random = ThreadLocalRandom.current() - val entries = List(10000) { SimTraceWorkload.Fragment(it * 1000L, 1000, random.nextDouble(0.0, 4500.0), 1) } - trace = entries.asSequence() + val builder = SimTrace.builder() + repeat(10000) { + val timestamp = it.toLong() + val deadline = timestamp + 1000 + builder.add(timestamp, deadline, random.nextDouble(0.0, 4500.0), 1) + } + trace = builder.build() } @Benchmark |
