mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Faster member list by avoiding many FFI calls (#2322)
* Faster member list by avoiding many FFI calls
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
Improve room member list loading times, increase chunk size
|
||||||
+2
-1
@@ -40,7 +40,7 @@ import kotlin.coroutines.coroutineContext
|
|||||||
internal class RoomMemberListFetcher(
|
internal class RoomMemberListFetcher(
|
||||||
private val room: RoomInterface,
|
private val room: RoomInterface,
|
||||||
private val dispatcher: CoroutineDispatcher,
|
private val dispatcher: CoroutineDispatcher,
|
||||||
private val pageSize: Int = 1000,
|
private val pageSize: Int = 10_000,
|
||||||
) {
|
) {
|
||||||
private val updatedRoomMemberMutex = Mutex()
|
private val updatedRoomMemberMutex = Mutex()
|
||||||
private val roomId = room.id()
|
private val roomId = room.id()
|
||||||
@@ -108,6 +108,7 @@ internal class RoomMemberListFetcher(
|
|||||||
// We should probably implement some sort of paging in the future.
|
// We should probably implement some sort of paging in the future.
|
||||||
coroutineContext.ensureActive()
|
coroutineContext.ensureActive()
|
||||||
val chunk = iterator.nextChunk(pageSize.toUInt())
|
val chunk = iterator.nextChunk(pageSize.toUInt())
|
||||||
|
// Load next chunk. If null (no more items), exit the loop
|
||||||
val members = chunk?.parallelMap(RoomMemberMapper::map) ?: break
|
val members = chunk?.parallelMap(RoomMemberMapper::map) ?: break
|
||||||
addAll(members)
|
addAll(members)
|
||||||
Timber.i("Emitting first $size members for room $roomId")
|
Timber.i("Emitting first $size members for room $roomId")
|
||||||
|
|||||||
Reference in New Issue
Block a user