5

Friends

I'm curious about which one is the faster way.

  • If i access/read the files from Assets folder of the project?!!

OR

  • If i access/read the files from the SDcard??!!!

Based on the performance of the application which one of is the better way?

Please can anyone explain me with reason?

Any help will be appreciated.

Thank you.

1
  • 3
    Accessing the Assets folder would be quicker because that data is available in the RAM, which has quicker access time than flash drives Feb 13, 2014 at 7:22

2 Answers 2

2

Based on the performance of the application which one of is the best way

When you are adding files to the assets folder your whole application's size increases, hence you will require more of your device's RAM to execute the application. While the app will react faster it also requires more memory to run.

But when you are storing that file on SD card then you will require less RAM to load the your application. Fetching files from SD card will reduce your performance more than the first option but the difference is little.

2
  • But as the assets folder is read-only. So if i want to modify some files at runtime at that time i have to get that file to sdcard and then only can modify it. In this situation it will definitely affect the performance right. What you will say for this scenario?
    – GrIsHu
    Feb 13, 2014 at 7:27
  • One more thing if you place file more than 1MB in assets then it won't allow you. In this situation you have to store it into sdcard and then need to access it. So if the file size would be nearer to 1MB it will leads your application to a bit slower to load into memory and it will slow down your application also.
    – GrIsHu
    Feb 13, 2014 at 7:37
2

I want to add some more here, you need to consider your file size too in case of access performance. Referring from This, Files over 1Mb placed in the Assets folder won't be readable from your application, will throw exception. Because files got compressed during the build process, and thus a phone requires resources to uncompress them when they are on the handset.
Generally, when your file size is small, definitely reading from asset folder is faster than reading from sd card. But in my opinion, if you consider file size and exception security, then it is safer to read it from sd card.It increases overall system performance rather than some minor time difference which isn't visible in your eye infact.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.