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

make the DiskLruCache's initialize() public through the Cache interface #1760

Merged
merged 1 commit into from
Jul 22, 2015

Conversation

halizton
Copy link

The DiskLruCache’s cache does lazy initialization. The time spent in
initialization varies depending on the actual cache size and journal
file size.

On very low end device, the initialization time could be as long as
1000 ms once the cache reaches 100M for example on a 4.0 device. This
has significant performance impact on the very 1st cache hit.

So the proposed solution is to give the developer an opportunity to
explicitly do the initialization early on and in a back ground thread.
Without this change, the developer would have to call any method from
the Cache class to warm up the cache implicitly.

@@ -198,7 +198,7 @@ public void run() {
}

// Visible for testing.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is no longer necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accepted and will change.

@swankjesse
Copy link
Collaborator

Works for me. One small comment, and also please use http://rebaseandsqua.sh.

@swankjesse
Copy link
Collaborator

CLA is good!

make the DiskLruCache's initialize() public through the Cache interface

The DiskLruCache’s cache does lazy initialization. The time spent in
initialization varies depending on the actual cache size and journal
file size.

On very low end device, the initialization time could be as long as
1000 ms once the cache reaches 100M for example on a 4.0 device. This
has significant performance impact on the very 1st cache hit.

So the proposed solution is to give the developer an opportunity to
explicitly do the initialization early on and in a back ground thread.
Without this change, the developer would have to call any method from
the Cache class to warm up the cache implicitly.
@halizton
Copy link
Author

Thanks, swankjesse, I used rebaseandsqua.sh to squash the 3 commits into one. What's CLA by the way?

swankjesse added a commit that referenced this pull request Jul 22, 2015
make the DiskLruCache's initialize() public through the Cache interface
@swankjesse swankjesse merged commit 291870e into square:master Jul 22, 2015
@swankjesse
Copy link
Collaborator

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants