0

I have an xml file which contains numerous data that is needed for a program. The data x,y,z are only needed for function 'a' while p,q,r are needed for the whole project. Some data items in the file tend to be very large. (i.e - a float vector with 50,000 items).
Is it better to read this data at once and store it in variables or to read it only when the method is called, this will cause the file to be opened twice. (I.m using pugixml to read data)

Thanks.

Madz
  • 1,273
  • 2
  • 18
  • 35

1 Answers1

0

I think that that depends on your requirements, which will determine which will be chosen. For example, the performance of the program, if it will need a large memory if read all the data once. If not, you can read once, because frequent IO is not a good choice.

cuish
  • 21
  • 2