c++ - Databases vs Files (performance) -


my c++ program has read information 256 images just 1 time. information simple: path , floats per image.

i don't need kind of concurrent access. also, don't care writing, deleting or updating information , don't have kind of complex query. pipeline:

  1. read information 1 image.
  2. store information on object.
  3. do calculation information.
  4. delete object.
  5. next image.

i can use 256 files (every image has same information), 1 file information or postgresql databases. what faster?

your question 'which faster' tricky performance dependent on many different factors, including os, whether database or file system on same machines application, size of images etc. guess find combinations make of options faster if try hard enough.

having said that, if running on same machine, file based approach seem intuitively faster database, because database provides more functionality, , hence more work (not serving requests in background also) has use more of computing power.

similarly, seems intuitive single file more efficient multiple files saves opening (and closing if necessary) operations associated multiple files. but, again, giving absolute answer hard opening , closing multiple files may common use case os's have optimised, hence making fast (or faster) using single file.

if performance important solution, hard avoid having comparative testing target deployment systems.


Comments