Skip to main content
SangHee
Known Participant
Jun 10, 2014 1:45 PM UTC
Answered

Time to load images using Loader from File.applicationDirectory or File.applicationStorageDirectory

While I test to load many images using Loader from File.applicationDirectory or File.applicationStorageDirectory, I found something strange.

It took about 2 times longer to load images from File.applicationDirectory than from File.applicationStorageDirectory.

I have googled for a long time, but I found why.

Does anyone know why?

Thank you!!

This topic is closed to new replies. Start a new post to keep the conversation going.
jadams602
jadams602Correct answer
Inspiring
Jun 10, 2014 10:19 PM UTC

Is this on Android by chance? If so it makes sense. On Android the applicationDirectory assets are stored in the original .apk (zipped) format and File I/O is automatically abstracted for you so that you think you are accessing files on the filesystem but what you are also doing is extracting the bytes of the files from the zipped contents first.

Same effect can be seen when you see slower copy operations when copying a bunch of individual files one at a time from File.applicationDirectory as opposed to copying a .zip from applicationDirectory and expanding the zip in another directory instead. Mentioned in this discussion:

File.copyTo (and copyToAsync) extremely slow on Android. e.g. 1/2 second per tiny XML file. Help?

2 replies

jadams602
jadams602Correct answer
Inspiring
Jun 10, 2014 10:19 PM UTC

Is this on Android by chance? If so it makes sense. On Android the applicationDirectory assets are stored in the original .apk (zipped) format and File I/O is automatically abstracted for you so that you think you are accessing files on the filesystem but what you are also doing is extracting the bytes of the files from the zipped contents first.

Same effect can be seen when you see slower copy operations when copying a bunch of individual files one at a time from File.applicationDirectory as opposed to copying a .zip from applicationDirectory and expanding the zip in another directory instead. Mentioned in this discussion:

File.copyTo (and copyToAsync) extremely slow on Android. e.g. 1/2 second per tiny XML file. Help?

Translate
SangHee
SangHeeAuthor
Known Participant
Jun 11, 2014 12:21 AM UTC

Yes, on the Android device.

I am developing a mobile game and I tested image loading time.

Now, it loads many thumbnail images from File.applicationDirectory.

I will have to find another way.

Thank you very much !!

Translate