-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Reduce Glide setup time #299
Comments
The problem is that you need everything ready when you start to load the first image, i.e. the first occurrence of Just throwing it in: the |
My thought is just that Glide shouldn't contribute to delaying cold start times. Even though apps would still have to pay the price when they load the first image, many apps will be able to show some content before or while loading images. By avoiding the class loader penalty until the first image load, we let apps get past the blank loading screen faster. |
30ms is really not much and perfectly acceptable IMHO |
We have a plan to make this and initializing Glide in general easier. We will add an interface that looks something like this: public interface GlideModule {
void initialize(Context context, Glide glide);
} Users of the library can implement that module, and then add a metadata tag to their <meta-data
android:name="glidemodule:com.bumptech.glide.samples.flickr.FlickrGlideModule"
android:value="" /> When the Glide singleton is first created, it can read the metadata tag, use reflection to instantiate the module, and call initialize. Since both reading the metadata and the reflection happen only on the first Glide.with() call, the overhead should be minimal. Using this strategy avoids the requirement that users call Glide.get() eagerly in their application and/or activities when they want to register components, which provides two benefits:
The only caveat is that users will need to add their implementation of the module to their proguard config so it isn't stripped out. |
Currently it seems like it can take up to 30ms. We should consider ways to reduce that time or at least allow ModelLoaders to be registered lazily. Branching from @TWiStErRob in #295:
The text was updated successfully, but these errors were encountered: