views:

84

answers:

3

hi,

I am working on a program that requires me to input values for 12 objects, each with 4 arrays, each with 100 values. (4800) values. The 4 arrays represent possible outcomes based on 2 boolean values... i.e. YY, YN, NN, NY and the 100 values to the array are what I want to extract based on another inputted variable.

I previously have all possible outcomes in a csv file, and have imported these into sqlite where I can query then for the value using sql. However, It has been suggested to me that sqlite database is not the way to go, and instead I should populate using arrays hardcoded.

Which would be better during run time and for memory management?

A: 

Most likely sqlite will always be less efficient then hardcoded variables, but sqlite would offer other advantages down the road, potentially making maintenance of the code easier. I would think that it would be difficult, for the amount of data that you are talking about from really noticing a difference between 4800 values being stored in the code or being stored in a database.

sqlite would easily beat your CSV though as far as processing time, and memory management would depending a lot on how efficient your language of choice handles .csv versus sqlite connectivity.

Kitson
A: 

Usually a database is used when you want to handle many data (or potentially you could handle many data), and you want a faster way to search part of the data.
If you are just need to save few values, then you probably don't need a database engine.

kiamlaluno
A: 

If you only need to query the data (no update/delete/insert), I won't suggset to use sqlite. I think the hardcode version beat sqlite both in run time and memory efficiency.

pierr