2

I'm using files in my app and I was wondering, since all user will be using the sames files (for my example), i'm providing them in the app bundle.

Now, my question is :

Is it faster to access it straight from the bundle or should I save it as a file and then access that file only later on ? We're talking about sound files that will be played many many times and that will never be removed from the app.

I'm really just talking about performance, not "code beauty". It's pretty much the same code-wise anyway.

Gil Sand
  • 5,802
  • 5
  • 36
  • 78
  • Why you expect that speed/performance must differ? – sage444 Jan 20 '15 at 14:53
  • Because one is a file that is in a .app, and the other is just a file on the phone that doesn't need to be "extracted" out of the bundle. I just feel like one is "getting a pencil from the table" and the other is "getting a pencil out of the drawer". So maybe if I put all my pencils on my desk i'll just be faster in the future. – Gil Sand Jan 20 '15 at 14:54
  • I'm asking because I believe that applications on device not stored in zipped state they should be decompressed during install – sage444 Jan 20 '15 at 15:01

1 Answers1

1

Its upto you, if you directly wanna store it as music file, it will consume larger space in app bundle, no other harm.

Whereas if you store them as a file in text (bytes), then convert them into mp3 at runtime, obviously, it will cost some lifecycle time. But it will also reduce your app size.

Now decision depends on your application requirements.

Mrunal
  • 13,982
  • 6
  • 52
  • 96