Skip to content

Commit

Permalink
use better optimized fluxo store config for benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Nov 29, 2024
1 parent 25efec1 commit c5d5abc
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package pro.respawn.flowmvi.benchmarks.setup.fluxo
import kotlinx.coroutines.Dispatchers
import kt.fluxo.core.annotation.ExperimentalFluxoApi
import kt.fluxo.core.store
import kt.fluxo.core.updateState
import pro.respawn.flowmvi.benchmarks.setup.BenchmarkIntent
import pro.respawn.flowmvi.benchmarks.setup.BenchmarkState

@OptIn(ExperimentalFluxoApi::class)
internal inline fun fluxoStore(
) = store(BenchmarkState(), handler = { it: BenchmarkIntent ->
updateState { it.copy(counter = it.counter + 1) }
) = store(BenchmarkState(), reducer = { it: BenchmarkIntent ->
when (it) {
BenchmarkIntent.Increment -> copy(counter = counter + 1)
}
}) {
coroutineContext = Dispatchers.Unconfined
intentStrategy = Direct
Expand Down

0 comments on commit c5d5abc

Please sign in to comment.