PDA

View Full Version : Best place to store some textual files



Momergil
10th August 2013, 15:16
Hello!

I'm struggling with regarding a decision related to memory (both hard-disk and RAM) comsumption in a particular app of mine...

I need to store some lines of data used in the execution of a particular dialog of mine, where some text and some images will be shown. The images shall be stored in the resource files, but I'm not sure what's the best way to store the textual file, containing both the paths to the images, the title and the description of each of my material.

I see 3 viable options:

*Store it in a txt file and put it in the resource file as well;
*Store in a txt file and put it in the app's folder
*Let the data be in the source code.

I'm not sure which is the best option. As far as I know, to put the txt file in the base folder and read it as a normal text file not only gives the opportunity for having a missing file (in one that is particularly relevant to the application), but also has the disavantage of the slow operation of reading from the hard-disk. To put it in the resource file means less risk, but I don't know about improving in the speed of reading. Moreover, doesn't that increase any RAM comsumption or something else? (the size of the .exe file?) And regarding to put it in the source code, well I find it to be quite lame :P


I'l welcome any advice will be welcomed :)

Thanks,

Momergil

cydside
10th August 2013, 15:22
Why don'you use an Sqlite database that has the :memory: solution too.

Lesiok
10th August 2013, 18:48
Momergil, what would you have done the size of the data is always the same and always data will be written to disk. How it really is size of the text data ? I have a feeling that you're looking for a problem where it does not.
cydside how will the data be in the memory ? From the disk.

Lykurg
10th August 2013, 18:49
Why don'you use an Sqlite database that has the :memory: solution too.
And how do you get the text in that database? The problems still exist: source code, resource or in file.

There is no general answer to that question :-( It all depends on the size of the textfiles. If they are small, I would store them in the resource file. It is the easiest one and if you are on a Desktop machine, there is "no" measurable performance impact.