musikr.pipeline: disable extraction shuffling
No longer needed now that jpeg writes are extremely quick. Will re-introduce in the case that I introduce webp parsing again.
This commit is contained in:
parent
a598f39dea
commit
9f68f59504
2 changed files with 0 additions and 13 deletions
|
@ -90,7 +90,6 @@ private class ExtractStepImpl(
|
||||||
|
|
||||||
val fds =
|
val fds =
|
||||||
uncachedSongs
|
uncachedSongs
|
||||||
.shuffle()
|
|
||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
wrap(it) { file ->
|
wrap(it) { file ->
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
|
|
|
@ -82,15 +82,3 @@ internal fun <T> Flow<T>.distribute(n: Int): DistributedFlow<T> {
|
||||||
val hotFlows = posChannels.map { it.receiveAsFlow() }.toTypedArray()
|
val hotFlows = posChannels.map { it.receiveAsFlow() }.toTypedArray()
|
||||||
return DistributedFlow(managerFlow, hotFlows)
|
return DistributedFlow(managerFlow, hotFlows)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T> Flow<T>.shuffle() = flow {
|
|
||||||
// As far as I'm aware, the only way to get a truly normal distribution
|
|
||||||
// on a flow is by evaluating it. I tried a bunch of different strategies
|
|
||||||
// on lazily shuffling a flow and it simply doesn't produce a good enough
|
|
||||||
// distribution since you need to emit late stuff early and early stuff
|
|
||||||
// late. It's best to just eval and re-emit.
|
|
||||||
val output = mutableListOf<T>()
|
|
||||||
toList(output)
|
|
||||||
output.shuffle()
|
|
||||||
emitAll(output.asFlow())
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue