Skip to main content
SangHee
Known Participant
June 10, 2014
Answered

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

  • June 10, 2014
  • 1 reply
  • 398 views

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 has been closed for replies.
Correct answer jadams602

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?

1 reply

jadams602
jadams602Correct answer
Inspiring
June 10, 2014

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?

SangHee
SangHeeAuthor
Known Participant
June 11, 2014

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 !!