-
Notifications
You must be signed in to change notification settings - Fork 149
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
MapCache's cache size slow loading #138
Comments
Further tests seems to show something weirder: (Same cache size throughout this test, cache has increased since original comment.)
Instead of the current commit being slow, I have noticed that, it seems like the size calculation have already done, but label was not updated. (If I were to slightly pull the view down and back, the label is updated with the size). The other commit loads almost instantaneously without user intervention. |
@vincentneo It used to work in iOS12, but I think with iOS13 stopped working. Regarding the weird size, did you run the unit tests of MapCache? Although there are some issues with them, size test seemed to work fine. |
I haven't tried the unit tests. That said, I was wondering that could it be an async-related issue of some sort instead? |
I found out the reason why you get a different size. While current implementation looks at the actual data the file has (for instance, an image may have 656 bytes of data) the implementation you shared counts the allocated disk, which is done in blocks of 4096 bytes. In the 656 bytes example you would get 1 block = 4096 bytes. Now, my doubt now is what makes more sense to count... disk usage or the actual size... In any case, there is an issue returning the cache size in MapCache in iOS13 |
So in that kind of a rationale, a 4097 bytes image would report 8192 bytes, due to actual allocation on disk? In that case, I feel that it would make more sense to have your implementation, as I feel that the size calculation, should some what follow what is default in macOS anyway: a 152 byte text file is still represented as such, except in 'Get Info', where its represented as 152 bytes (4 KB on disk) |
I finally decided to implement the calculation of both sizes in MapCache (V0.6.0), however I switched to use the allocated disk size internally for keeping capacity limits While updating OpenGPXTracker I noticed: merlos/MapCache#14 Fix will be applied when merging #139 |
I have tested the app quite a lot, and had my cache size at 77.4MB.
It took quite a while for that large of a cache size to load. Placeholder text 'Zero KB', is hence, slightly confusing to a possible user too.
I have tried making MapCache branch
fasterDirectorySize
by using someone else's code to count file directory size,but while it seems marginally faster, it still is, only 'marginally faster'.I guess I forgot to 'clean' before running. Actually quite a lot faster! :)The text was updated successfully, but these errors were encountered: