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

[PINCache] Set a default .byteLimit to reduce disk usage & startup time. #595

Merged
merged 2 commits into from
Oct 4, 2017

Conversation

appleguy
Copy link
Member

This default is fairly low - only 20MB - but for most apps with images
in the size range of 10-50KB, this is still 400-1000 images.

Once some optimizations land to PINCache, we'll match the PINCache
default of 50MB to ensure the default better serves users with larger
objects in the cache.

Apps should preferably set their own byteLimit to an optimal value.

@garrettmoon - one interesting question for us is the best place to
set .byteLimit as an app. Digging into the ASPINRemoteImageDownloader
and doing this type cast is a bit complicated, so a passthrough API
to get the PIN* objects directly might be worthwhile.

This default is fairly low - only 20MB - but for most apps with images
in the size range of 10-50KB, this is still 400-1000 images.

Once some optimizations land to PINCache, we'll match the PINCache
default of 50MB to ensure the default better serves users with larger
objects in the cache.

Apps should preferably set their own byteLimit to an optimal value.

@garrettmoon - one interesting question for us is the best place to
set .byteLimit as an app. Digging into the ASPINRemoteImageDownloader
and doing this type cast is a bit complicated, so a passthrough API
to get the PIN* objects directly might be worthwhile.
@ghost
Copy link

ghost commented Sep 29, 2017

🚫 CI failed with log

@garrettmoon
Copy link
Member

@appleguy Yeah, that's a good idea, but I don't want to get all my Hacktoberfest PRs done in one day :P


// Set a default byteLimit. PINCache recently implemented a 50MB default (PR #201).
// Ensure that older versions of PINCache also have a byteLimit applied.
PINDiskCache *diskCache = [ASDynamicCast(cache, PINCache) diskCache];
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to add a <PINCache/PINCache.h> include at the top.

Copy link
Member

@garrettmoon garrettmoon left a comment

Choose a reason for hiding this comment

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

But LGTM once the build passes.

@appleguy
Copy link
Member Author

Thanks! Looking into the right way to either reference, or avoid referencing PINCache as a symbol.

@ghost
Copy link

ghost commented Sep 29, 2017

🚫 CI failed with log

@appleguy
Copy link
Member Author

@garrettmoon FYI, it looks like this test failure is spurious - it doesn't reproduce on my local machine, this patch isn't related, and it will probably pass upon retry. Had to do a fake commit change to poke the server.

✗ testThatMultipleBatchFetchesDontHappenUnnecessarily, failed - Too many batch fetches!

@maicki
Copy link
Contributor

maicki commented Sep 30, 2017

I had the same issue in a previous PR opened a couple of days ago. I had to manually retry the CI and the next time it finished successfully.

Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

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

LGTM

@appleguy appleguy merged commit 7a07d9e into master Oct 4, 2017
@appleguy appleguy deleted the CacheDefault branch October 4, 2017 02:32
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…me. (TextureGroup#595)

* [PINCache] Set a default .byteLimit to reduce disk usage & startup time.

This default is fairly low - only 20MB - but for most apps with images
in the size range of 10-50KB, this is still 400-1000 images.

Once some optimizations land to PINCache, we'll match the PINCache
default of 50MB to ensure the default better serves users with larger
objects in the cache.

Apps should preferably set their own byteLimit to an optimal value.

@garrettmoon - one interesting question for us is the best place to
set .byteLimit as an app. Digging into the ASPINRemoteImageDownloader
and doing this type cast is a bit complicated, so a passthrough API
to get the PIN* objects directly might be worthwhile.

* [PINCache] Declare necessary APIs to avoid a direct dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants