Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top