Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MaterialDatePicker + MaterialTimePicker] (Maybe others as well) slow load time #1910

Open
chennemann opened this issue Nov 30, 2020 · 8 comments

Comments

@chennemann
Copy link

Description:

I want to use those components in my app but I notice some really unusual loading speed for the initial load after the app is cold started. It takes up to three seconds for the pickers to show up after they are requested.

ezgif-1-496c20434c9e

That behaviour happens when I start the application from Android Studio on my phone or in the emulator. When I use the Sample App for the Material Components from the PlayStore it's behaving normally (so no opening delay). I'm actually kinda clueless what the reasoning might be.

Consecutive clicks are faster.

Expected behavior:

The Pickers should show up nearly instantaneously.

Source code:

This screencapture is from a minimal application that consists just of one Activity:

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        findViewById<Button>(R.id.datePicker).setOnClickListener {
            MaterialDatePicker.Builder.datePicker().build().show(supportFragmentManager, "DATE_PICKER")
        }

        findViewById<Button>(R.id.timePicker).setOnClickListener {
            MaterialTimePicker.Builder().build().show(supportFragmentManager, "DATE_PICKER")
        }
    }
}

The layout just contains the two buttons:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/datePicker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Open Date Picker"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.497"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.33" />

    <Button
        android:id="@+id/timePicker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Open Time Picker"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/datePicker" />

</androidx.constraintlayout.widget.ConstraintLayout>

Android API version: 10

Material Library version: 1.3.0-alpha04

Device: OnePlus 6T & Emulator in Android Studio

@chennemann chennemann added the bug label Nov 30, 2020
@wcshi wcshi changed the title [MaterialDatePicker + MaterialTimePicker] (Maybe others as well) Short description of issue [MaterialDatePicker + MaterialTimePicker] (Maybe others as well) slow load time Dec 1, 2020
@YMonnier
Copy link

@chennemann do you know if this latency has been fixed?

@pedro-mgb
Copy link

I built the catalog module in debug mode and noticed there was a delay as well.

video-75d7fcad-efe2-4bbf-8575-983ca5e43fc2-1662569342.mp4

When I use the app from the play store, it is much quicker.
Furthermore, when displaying a date picker in my app, it displays much quicker in release than in debug.
Is there some block of code in the material library that only runs in debug and is adding a considerable overhead?

@LaurentLixfe
Copy link

For people landing here, you need to test with release config because the debug's one is very slow

@DikenMaharjan
Copy link

is there any update to this?

@nikunjparadva
Copy link

too much lag while opening RangePicker.

@onurerden
Copy link

I also want to give a feedback, as @LaurentLixfe mentioned, when you build your app in Release configuration, all components run much faster, fast enough as they should. Please try to test in release, for performance tests.

@nikunjparadva
Copy link

Yes Thanks @onurerden for your feedback, It was working perfectly in Release but it takes too much freez in Debug version
@dsn5ft @leticiarossi Please take a look over the issue which is happening in debug version.

@CyberButton
Copy link

For people landing here, you need to test with release config because the debug's one is very slow

Thanks!, it really works fine on release version but is extrememly laggy in debug,
I was using material date range picker, every time I scroll it would freeze for like a second or more depending on the phone I tested. I think the problem of laggy scrolling in debug version may be realted to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants