I was wondering if there has been any recent optim...
# compose
c
I was wondering if there has been any recent optimization of the scrolling behavior of the
LazyColumn
. I compared it today to
RecyclerView
and it's really bad...
jetpack compose 1
☝️ 4
💯 2
h
There have been several patches that included optimizations to
LazyColumn
and those will sure continue. The best thing we developers can do is sharing our findings with the team. Would you be able to share your comparison code with the
RecyclerView
?
r
We are working on various optimizations for this and other use cases. But please keep feedback coming
s
Yup it still needs a lot more optimization. The scrolling is not smooth even for a simple list layout
t
In my experience the LazColumn do compete well with recyclerview. So it would be nice if you could provide samples where it does have problems. But i do not see really improvements from beta01 to beta05. Here is a sample from my "Pixel 3a" (Without recording it is most of the time under the green line).
c
@Halil Ozercan @romainguy They are the lists displayed by
RecyclerView
(1) and
LazyColumn
(2) respectively. Just fill the
LazyColumn
with a randomly generated list:
Copy code
val tests by lazy {
  (0..400).map {
    val length = (2..15).random()
    val allowedChars = ('A'..'Z') + ('a'..'z') + ('0'..'9')
    val prefix = if (length < 5) "." else ""
    val suffix = if (length > 7) ".${(1..5).map { allowedChars.random() }}" else ""
    val name = prefix + (1..length)
      .map { allowedChars.random() }
      .joinToString("") + suffix
    val isDirectory = (0..1).random() == 1

    FileItem(
      name = name,
      time = abs(System.currentTimeMillis() - Random().nextLong()).asMilliInstant().format("yyyy-MM-dd HH:mm"),
      size = (0L..1855425871872L).random().toReadableSize(),
      isDirectory = isDirectory
    )
  }
}